Many times for the sake of testing you might have dumped manually form fields fake data to the database. Lot of times while demoing the applications to your client you may have seen this fake junk data from your database which may not make any sense to your clients, even they might not understand lot of things for this purpose.

In this article, you will learn how to generate the fake data with PHP Faker from this packagefzaninotto/Faker.


Prerequisites

I hope you have **composer** installed in your system. Composer is a PHP dependency manager. To install composer you can use the following command

Linux/Ubunut

sudo apt-get update
sudo apt-get install composer

Step 1 - Install PHP Faker Package With Composer

I am creating new project test inside htdocs folder, you might have to create inside /var/www/html or any other working directory for your PHP.

First and the foremost thing is PHP Faker library you can install it with the help of the following command. Go to your htdocs/test project and run the following

composer require fzaninotto/faker

After installation you will have the following project folder structure. After using the above command you will have

Project Structure After Composer Package InstallationProject Structure After Composer Package Installation

#php

How To Generate Fake Data In PHP With Faker
3.90 GEEK