9951 explained code solutions for 126 technologies


php-fakerHow can I generate a fake company name using Laravel Faker?


Using Laravel Faker, you can easily generate a fake company name.

Example code

$faker = Faker\Factory::create();
$companyName = $faker->company;
echo $companyName;

Output example

Jaskolski-Bergstrom

The code above creates an instance of the Faker class using the create() method, and then uses the company property of the Faker class to generate a fake company name.

Code explanation

  1. $faker = Faker\Factory::create(); creates an instance of the Faker class.
  2. $companyName = $faker->company; uses the company property of the Faker class to generate a fake company name.
  3. echo $companyName; outputs the fake company name.

Helpful links

Edit this code on GitHub