Skip to content

geekish/faker-providers

Repository files navigation

geekish/faker-providers

Latest Version on Packagist Tests Total Downloads

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
    • author
    • genre
    • bookTitle
    • bookSeries
  • Horse
    • horseBreed
  • Music
    • musicalGenre
    • instrument
    • band
    • femaleMusician
    • maleMusician
    • musician (generates any of the previous three)
  • StarWars
    • starWarsCharacter
    • starWarsDroid
    • starWarsPlanet
    • starWarsSpecies
    • starWarsVehicle
  • Space
    • constellation
    • cluster
    • dwarfPlanet
    • galaxy
    • planet
    • moon
    • nebula
    • star

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.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages