Download the PHP package innoflash/steroid-seeder without Composer
On this page you can find all versions of the php package innoflash/steroid-seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download innoflash/steroid-seeder
More information about innoflash/steroid-seeder
Files in innoflash/steroid-seeder
Package steroid-seeder
Short Description A Laravel package to speed up seeding in Laravel.
License MIT
Homepage https://github.com/innoflash/steroid-seeder
Informations about the package steroid-seeder
About Steroid-Seeder
This package is built to reduce the time taken when seeding a lot data to the database on development.
Installation
You can install the package via composer:
Usage
Used the same way we do with default Laravel factory
If you wanna use it in your existing seeding files just replace
factorywithsteroidFactoryAlternatively you can call the factory from the facade.
SteroidSeeder::factory
Default factory seeds one model at a time and that elongates the time of execution for huge data-sets.
Steroid seeder optimization.
-
By default the
steroidFactorysave 1000 entries at a go, you cant tune this to whatever size that works for you. - By default the Laravel factory calls some callbacks after creating your models. This is when the model boot and observers are called and its time consuming because the factory iterate over all the created models. steroidFactory lets you ignore the callbacks.
Seeding relationships
Steroid seeder can be used to create models with their relationships.
It's a continuation of the above except that the you will need to chain your relationships on the factory. See the example below:
Here is the params expected in the with function. |
Position | Variable | Type | Required | Default | Description |
|---|---|---|---|---|---|---|
1 |
$class |
string |
true |
null |
The class name of the model to be related with the model in create. | |
2 |
$size |
int |
false |
1 |
The number of models to be seeded with the parent increate. |
|
3 |
$attributes |
array |
false |
[] |
The default attributes to set to the models. | |
4 |
$foreignKeyName |
string |
false |
parent key | The name of the parent's foreign key column name in the models to be seeded. |
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Innocent Mazando
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.
All versions of steroid-seeder with dependencies
illuminate/database Version ^6.0|^7.0
illuminate/support Version ^6.0|^7.0