Download the PHP package distinctm/laravel-data-sync without Composer
On this page you can find all versions of the php package distinctm/laravel-data-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download distinctm/laravel-data-sync
More information about distinctm/laravel-data-sync
Files in distinctm/laravel-data-sync
Download distinctm/laravel-data-sync
More information about distinctm/laravel-data-sync
Files in distinctm/laravel-data-sync
Vendor distinctm
Package laravel-data-sync
Short Description Laravel utility to keep records synced between environments through source control
License MIT
Package laravel-data-sync
Short Description Laravel utility to keep records synced between environments through source control
License MIT
Please rate this library. Is it a good library?
Informations about the package laravel-data-sync
Laravel Data Sync
Laravel utility to keep records synchronized between environments through source control
V3.1 branch Notes (Work in progress)
-
Adds support for Laravel 8+ models directory in
config/data-sync.php
: - Adds ability to export existing Models to data sync files:
which generates
- Further work is required to support remote disks. For testing & development of new V3.1 features, use
composer require nullthoughts/laravel-data-sync:v3.1.x-dev
Installation
You can install this package via composer:
Or add this line in your composer.json
, inside of the require
section:
then run composer install
Usage
- Run
php artisan vendor:publish --provider="nullthoughts\LaravelDataSync\DataSyncBaseServiceProvider" --tag="data-sync-config"
to publish config file. Specify directory for sync data files (default is a new sync directory in the project root) - Create a JSON file for each model, using the model name as the filename. Example: Product.json would update the Product model
- Use nested arrays in place of hardcoded IDs for relationships
- Run
php artisan data:sync
(orphp artisan data:sync --model={model}
with the model flag to specify a model)
Optional
If using Laravel Forge, you can have the data sync run automatically on deploy. Edit your deploy script in Site -> App to include:
Notes
- use studly case for model name relationships as JSON keys (example: 'option_group' => 'OptionGroup'). This is important for case sensitive file systems.
- empty values are skipped
- the criteria/attributes for updateOrCreate are identified with a leading underscore
- nested values represent relationships and are returned using where($key, $value)->first()->id
- order of import can be set in config/data-sync.php with an array:
Examples
User.json:
translates to...
Role.json:
translates to...
RoleUser.json (pivot table with model):
translates to...
All versions of laravel-data-sync with dependencies
PHP Build Version
Package Version
Requires
ext-json Version
*
php Version ^8.0
php Version ^8.0
The package distinctm/laravel-data-sync contains the following files
Loading the files please wait ....