geekish / faker-providers
Extra providers for Faker
Fund package maintenance!
0.1.0
2026-05-20 17:48 UTC
Requires
- php: ^8.4
- fakerphp/faker: ^1.9
- symfony/yaml: ^8.0
Requires (Dev)
- laravel/pint: ^1.0
- pestphp/pest: ^4.0
README
Adds some extra providers to fakerphp/faker. Some are ported/adapted from the original and mbezhanov/faker-provider-collection.
Installation
You can install the package via composer:
composer require geekish/faker-providers
Usage
To 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();
Providers
- Literature
authorgenrebookTitlebookSeries
- Horse
horseBreed
- Music
musicalGenreinstrumentbandfemaleMusicianmaleMusicianmusician(generates any of the previous three)
- StarWars
starWarsCharacterstarWarsDroidstarWarsPlanetstarWarsSpeciesstarWarsVehicle
- Space
constellationclusterdwarfPlanetgalaxyplanetmoonnebulastar
Testing
Each provider should be covered.
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.