Download the PHP package marwen-brini/smart-seeder without Composer
On this page you can find all versions of the php package marwen-brini/smart-seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marwen-brini/smart-seeder
More information about marwen-brini/smart-seeder
Files in marwen-brini/smart-seeder
Package smart-seeder
Short Description This is my package smart-seeder
License MIT
Homepage https://github.com/marwanov/smart-seeder
Informations about the package smart-seeder
Smart Seeder
Safe, intelligent database seeding for Laravel with preview capabilities, idempotent operations, environment awareness, and full rollback support.
Features
- Preview before execution - See exactly what will happen with
seed:plan - Idempotent operations - Run seeders multiple times safely
- Multiple seeding modes - upsert, insert_ignore, insert_only, update_only, sync
- Validation support - Validate records before insertion
- Dependency resolution - Automatically run seeders in the correct order
- Rollback support - Undo seeder operations with
seed:undo - AutoFaker - Smart fake data generation based on field names
- Laravel Factory support - Use existing factories in seeders
- Lifecycle hooks - Run custom logic after insert/update operations
- Data transformation - Transform and mutate records before insertion
- History tracking - Track all seeder executions
Requirements
- PHP ^8.3 || ^8.4
- Laravel ^11.0 || ^12.0
Installation
Publish and run the migrations for history tracking:
Optionally publish the config file:
Quick Start
Create a Seeder
Define Your Seeder
Preview Changes
Execute Safely
Seeding Modes
| Mode | Insert New | Update Existing | Delete Missing |
|---|---|---|---|
upsert |
Yes | Yes | No |
insert_ignore |
Yes | No | No |
insert_only |
Yes | Error | No |
update_only |
No | Yes | No |
sync |
Yes | Yes | Yes |
Data Generation
Manual Data
AutoFaker
AutoFaker automatically detects field types and generates appropriate fake data:
Laravel Factory
Use existing Laravel factories:
Validation
Dependencies
Define seeder dependencies to ensure correct execution order:
Run with dependencies:
Commands
seed:plan
Preview what a seeder will do:
seed:safe
Execute a seeder safely:
seed:undo
Rollback the last seeder execution:
seed:status
View seeder history:
seed:make
Generate a new seeder:
Lifecycle Hooks
Run custom logic after records are inserted or updated:
Data Transformation
Transform records before they are inserted:
Use mutators for field-level transformations:
Environment Awareness
Restrict seeders to specific environments:
Full Example
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover a security vulnerability, please send an email to [email protected]. All security vulnerabilities will be promptly addressed.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of smart-seeder with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0
illuminate/support Version ^11.0||^12.0