Yii1 database seeder

The Yii1 database seeder extension is now released!

Built with simplicity in mind, it brings you ability to fill your database with (mainly) Faker data by quickly configuring relations between the tables and columns of your tables and corresponding generators of fake data.

Have a look at how simple and straightforward the usage is:




$seeder = new \tebazil\yii1seeder\Seeder();

$generator = $seeder->getGeneratorConfigurator();

$faker = $generator->getFakerConfigurator();


$seeder->table('article')->columns([

    'id', //automatic pk

    'book_id', //automatic fk

    'name'=>$faker->firstName,

    'content'=>$faker->text

        ])->rowQuantity(30);




$seeder->table('book')->columns([

    'id',

    'name'=>$faker->text(20),

])->rowQuantity(30);


//etc...


$seeder->refill(); 



You can locate the code above in a console command to call it when you need your test data to be refreshed.

Here is the Yii1 extension. The framework-agnostic database seeding library is also available.

You are welcome to comment on my work and suggest improvements.

Thanks for your attention.