thetheago / laravel-seeder-versioning
A Laravel package that provides version control for database seeders, similar to Laravel's migration system. This package tracks which seeders have been run and only executes seeders that have been modified by monitoring class content changes.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/thetheago/laravel-seeder-versioning
Requires
- php: >=8.3
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^10.0
- phpunit/phpunit: ^12.0
README
A Laravel package that provides version control for database seeders, similar to Laravel's migration system. This package tracks which seeders have been run and only executes seeders that have been modified by monitoring class content changes.
Features
- Tracks seeder execution history
- Only runs modified seeders
- Validates seeder content changes using hash verification
- Simple integration with Laravel's existing seeder system
- Option to generate hash versioning without running seeders
Installation / Configuration
You can install the package via composer:
composer require thetheago/laravel-seeder-versioning
Publish the package configuration and migrations:
php artisan vendor:publish --tag=seeder-versioning
Run the migrations to create the seeder versioning table:
php artisan migrate
Usage
Running Seeders
To run your seeders with version control:
php artisan seed:migrate
This command will:
- Check all your seeders
- Compare their content against previously run versions
- Only execute seeders that have been modified or haven't been run before
Hash Generation Only
If you want to generate hash versions for your seeders without executing them:
php artisan seed:migrate --hash-only
This is useful for:
- Initial setup in existing projects
- Verifying which seeders would be executed
- Updating the version control table without running seeders
How It Works
The package creates a seeder_versioning table that stores:
- Seeder class names
- Content hashes
- Execution timestamps
When you run seed:migrate, the package:
- Scans your seeder directory
- Generates a hash for each seeder's content
- Compares against stored hashes
- Executes only modified or new seeders
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT license.