by coderello

🏭 An easy way to generate populated factories for models.

232 Stars 11 Forks Last release: about 2 months ago (1.0.0) MIT License 19 Commits 6 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Laravel Populated Factory

Laravel Populated Factory provides an easy way to generate populated factories for models according to types & names of their columns.


You can install this package via composer using this command:

composer require --dev coderello/laravel-populated-factory

The package will automatically register itself.


The only thing you need to do in order to generate a populated factory is to execute this command:

php artisan make:populated-factory User

This command assumes that the

model is in the
namespace. If your models are situated in another namespace (e.g.
) you should specify them either as

Here is the populated factory generated for the

model according to its column types & names.
/** @var $factory \Illuminate\Database\Eloquent\Factory */

$factory->define(\App\User::class, function (Faker $faker) { return [ 'name' => $faker->name, 'email' => $faker->unique()->safeEmail, 'email_verified_at' => $faker->dateTime, 'password' => '$2y$10$uTDnsRa0h7wLppc8/vB9C.YqsrAZwhjCgLWjcmpbndTmyo1k5tbRC', 'remember_token' => $faker->sha1, 'created_at' => $faker->dateTime, 'updated_at' => $faker->dateTime, ]; });

If you want a custom name for the factory, you need to pass it as the second argument like so:

php artisan make:populated-factory User AdminFactory

If you want to override the existent factory, you need to use

flag like so:
php artisan make:populated-factory User --force


Please see CONTRIBUTING for details.


The MIT License (MIT). Please see License File for more information.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.