Adds some extra providers to fakerphp/faker. Some are ported/adapted from the original and mbezhanov/faker-provider-collection.
You can install the package via composer:
composer require geekish/faker-providersTo register all providers:
use Faker\Generator;
$faker = new Faker\Generator();
FakerProviders::register($faker);In Laravel, adding providers to the Faker instance accessible via fake() can be done like so:
use Faker\Generator;
use Geekish\FakerProviders\FakerProviders;
use Illuminate\Foundation\Application;
$locale = $this->app->get('config')->get('app.faker_locale', 'en_US');
$abstract = Generator::class.':'.$locale;
$this->app->resolving($abstract, function (Generator $faker, Application $app) {
FakerProviders::register($faker);
return $faker;
});Of course, you are free to register the providers individually:
use Faker\Generator;
use Geekish\FakerProviders\Arts\Literature;
$faker = new Faker\Generator();
$faker->addProvider(new Literature($faker));
$faker->bookTitle();- Literature
authorgenrebookTitlebookSeries
- Horse
horseBreed
- Music
musicalGenreinstrumentbandfemaleMusicianmaleMusicianmusician(generates any of the previous three)
- StarWars
starWarsCharacterstarWarsDroidstarWarsPlanetstarWarsSpeciesstarWarsVehicle
- Space
constellationclusterdwarfPlanetgalaxyplanetmoonnebulastar
Each provider should be covered.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.