webikevn / laravel-seeder
Versioned, environment-based Seeders in Laravel
1.0
2020-07-06 09:10 UTC
Requires
- php: >=7.1.0
- illuminate/console: ^7.0
- illuminate/database: ^7.0
- illuminate/filesystem: ^7.0
- illuminate/support: ^7.0
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ^5.2
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-11-06 19:29:22 UTC
README
A Package was developed by River Crane Vietnam (MarketPlace)
Requirements
- Laravel >= 5.4
- PHP >= 7.1
Installation
- Run
composer require webikevn/laravel-seeder
- Add
Webikevn\LaravelSeeder\SeederServiceProvider::class
to your providers array inapp/config/app.php
- Run
php artisan vendor:publish
to push config files to your config folder if you want to override the name of the seeds folder, or the name of the table where seeds are stored
Features
- Allows you to seed databases in different environments with different values.
- Allows you to "version" seeds the same way that Laravel currently handles migrations. Running
php artisan seed
will only run seeds that haven't already been run. - Allows you to run multiple seeds of the same model/table
- Prompts you if your database is in production
Usage
When you install LaravelSeeder, various artisan commands are made available to you which use the same methodology you're used to using with Migrations.
Local Development
A Dockerfile with PHP 7.2, XDebug and Composer installed is bundled with the project to facilitate local development.
To easily bring up the local development environment, use the Docker Compose configuration:
docker-compose up -d --build
By default, the entrypoint script will install the Composer dependencies for you.
To run the test suite, execute the following:
docker-compose exec laravel-seeder test.sh
To run the code coverage suite, execute the following:
docker-compose exec laravel-seeder code-coverage.sh
Happy testing!