Download the PHP package oi-lab/oi-laravel-seeds without Composer
On this page you can find all versions of the php package oi-lab/oi-laravel-seeds. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oi-laravel-seeds
OI Laravel Seeds
A Laravel package to export and import seeders to/from JSON files with intelligent dependency management.
Features
- JSON Export/Import: Round-trip database data through portable, version-controllable JSON files
- Idempotent Imports: Rows are upserted by a unique key, so re-running never duplicates data
- Dependency Resolution: Seeders declare dependencies, ordered automatically via topological sort
- Relations: Export models together with their relations using
--with-relations - Multiple Models: Export/import several models from a single seeder
- Generator Command: Scaffold exportable seeders with one artisan command
- Configurable: Storage paths, default unique key, auto-discovery, and JSON encoding options
How It Works
- Export: The package scans your seeders for those using the
ExportableSeedertrait - Dependencies: It resolves dependencies using a topological sort to ensure correct order
- Export Data: Each seeder exports its model data to a JSON file in the configured storage path
- Import: When importing, dependencies are processed first, then data is upserted using
updateOrCreate
Requirements
- PHP 8.2+
- Laravel 11.0+ or 12.0+
Installation
Install the package via composer:
The package auto-discovers and registers its service provider — no manual registration required.
Local Development
For local development inside the monorepo, add a path repository to your main project's composer.json:
Publish
Publish the configuration file (optional):
Publish the seeder stubs (optional):
Usage
Creating an Exportable Seeder
Generate a new exportable seeder using the artisan command:
Options:
--modelor-m: The model class to use for this seeder--unique-byor-u: The unique column(s) for upsert operations (default: id)--json-filenameor-j: The JSON filename for export/import
This will create a seeder class like:
Defining Dependencies
If your seeder depends on other seeders, specify them in the $dependencies property:
Exporting Relations
To export models with their relations, define them in the $exportRelations property:
Then use the --with-relations flag when exporting:
Exporting Data
Export all exportable seeders:
Export a specific seeder:
Importing Data
Import all exportable seeders:
Import a specific seeder:
Customizing Exported Attributes
Override the getExportableAttributes method in your seeder to customize which attributes are exported:
Multiple Models per Seeder
You can export/import multiple models in a single seeder by using arrays:
Custom Unique Keys
Use multiple columns for unique constraints:
Configuration
The configuration file config/oi-laravel-seeds.php allows you to customize:
storage_path: Base storage path for JSON files (default:app/private/seeders)default_unique_by: Default column for upsert operations (default:id)auto_discover: Auto-discover exportable seeders (default:true)json_options: JSON encoding options (default:JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
By default, JSON files are stored in storage/app/private/seeders/. You can change this:
AI Assistant Skills
Install Claude Code / JetBrains Junie skill files and a CLAUDE.md rules section into your app:
See docs/advanced/skills.md for details.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see the License File for more information.
Credits
Olivier Lacombe - Creator and maintainer
Olivier is a Product & Technology Director based in Montpellier, France, with over 20 years of experience innovating in UX/UI and emerging technologies. He specializes in guiding enterprises toward cutting-edge digital solutions, combining user-centered design with continuous optimization and artificial intelligence integration.
Projects & Resources:
- OI Dev Docs - Documentation for all Open Source OI Lab packages
- OnAI - Training courses and masterclasses on generative AI for businesses
- Promptr - Prompt engineering Management Platform
Support
For support, please open an issue on the GitHub repository.