ambersive/yamlseeder

This package allows you to seed your tables with help of yaml files.
1,324 3
Install
composer require ambersive/yamlseeder
Latest Version:v0.2.2
License:MIT
Last Updated:Jan 13, 2025
Links: GitHub  ·  Packagist
Maintainer: sushidev

YAML SEEDER

Maintainability Build Status

Changes between versions will be tracked in the CHANGELOG.

Installation

composer require ambersive/yamlseeder
Optional: Publish the config
php artisan vendor:publish --tag=yaml-seeder

Usage

All the seeds will be executed if you run the classic

php artisan db:seed

Create yaml seed file

Create a yml file in database/seeds-yaml. Please use the .yml file extension.

The structure of the the seed looks like:

model: \AMBERSIVE\Tests\Examples\Models\Migration
primaryKey: id
fieldsOnCreate:
  - migration
  - batch
data:
  - id: 99
    batch: 1
    migration: 'users_test_table'

model: The model will define which data should be seeded.

primaryKey: Default it is 'id' if not defined.

exlude: Default is false. This defines if the file will be included within the normal db:seed process.

fieldsOnCreate: List of field name which defines which files will be need on a create statement. Make your fields nullable if you want to reduce the list.

data: Array of the actual data. Follow the structure of you model.

Command

 php artisan make:seeder-yaml demo --model=App/User

This command will create in the database/seeds-yaml folder a demo.yml file.

Feedback

Please feel free to give us feedback or any improvement suggestions.

Security Vulnerabilities

If you discover a security vulnerability within this package, please send an e-mail to Manuel Pirker-Ihl via manuel.pirker-ihl@ambersive.com. All security vulnerabilities will be promptly addressed.

License

This package is open-sourced software licensed under the MIT license.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released Laravel License
v0.2.2 6.*|7.*|8.* MIT
v0.2.1 6.*|7.*|8.* MIT
v0.2.0 6.*|7.*|8.* MIT
v0.1.3 6.*|7.*|8.* MIT
v0.1.2 6.*|7.*|8.* MIT
Pre-releases (1)
Version Released Laravel License
v0.1.0-alpha1 6.*|7.*|8.* MIT