Skip to content
JediFaker binding into Laravel factories
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
composer.json

README.md



Package provides simple JediFaker binding into Laravel factories.

JediFaker is an extension for Faker data generator. It does not affect original Faker in any way.

Installation

composer require hydreflab/laravel-jedi-faker

Service provider registration

No service provider registration in app.php is needed. Package uses Laravel auto discovery feature.

However, if for some reason you don't want to use auto discovery, disable that in your application's composer.json file:

"extra": {
    "laravel": {
        "dont-discover": [
            "hydreflab/laravel-jedi-faker"
        ]
    }
},

Then manually register HydrefLab\Laravel\JediFaker\JediFakerServiceProvider::class service provider.

Basic usage

New features added by JediFaker package can be used straight away in your Laravel factories:

$factory->define(App\User::class, function (Faker $faker) {
    return [
        'name' => $faker->character,
        'email' => $faker->unique()->safeEmail,
        'planet' => $faker->planet,
        'species' => $faker->species,
        'vehicle' => $faker->vehicle,
        'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
        'remember_token' => str_random(10),
    ];
});

For more details, check JediFaker repository.

Note: JediFaker package only adds new formatters and is not extending/overriding Faker generator, therefore IDE autocompletion will not work for newly added features.

Copyright and license

Package is licensed for use under the MIT License (MIT). Please, see LICENSE for more information.

You can’t perform that action at this time.