{"id":36996000,"url":"https://github.com/nullthoughts/laravel-data-sync","last_synced_at":"2026-01-13T23:48:21.746Z","repository":{"id":48976383,"uuid":"167080281","full_name":"nullthoughts/laravel-data-sync","owner":"nullthoughts","description":"Laravel utility to keep records synced between enviroments through source control","archived":false,"fork":false,"pushed_at":"2024-12-11T12:00:23.000Z","size":8053,"stargazers_count":33,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-11T17:31:32.414Z","etag":null,"topics":["data-sync","laravel"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nullthoughts.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-22T22:57:31.000Z","updated_at":"2024-12-11T12:00:12.000Z","dependencies_parsed_at":"2024-11-07T08:23:59.772Z","dependency_job_id":null,"html_url":"https://github.com/nullthoughts/laravel-data-sync","commit_stats":{"total_commits":74,"total_committers":10,"mean_commits":7.4,"dds":0.527027027027027,"last_synced_commit":"261e47bf7f9e0e31e6276c4f02c7338254cbf734"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nullthoughts/laravel-data-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullthoughts%2Flaravel-data-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullthoughts%2Flaravel-data-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullthoughts%2Flaravel-data-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullthoughts%2Flaravel-data-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullthoughts","download_url":"https://codeload.github.com/nullthoughts/laravel-data-sync/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullthoughts%2Flaravel-data-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-sync","laravel"],"created_at":"2026-01-13T23:48:21.683Z","updated_at":"2026-01-13T23:48:21.737Z","avatar_url":"https://github.com/nullthoughts.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://packagist.org/packages/nullthoughts/laravel-data-sync\" target=\"_blank\"\u003e\u003cimg src=\"https://poser.pugx.org/nullthoughts/laravel-data-sync/d/total.svg\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/nullthoughts/laravel-data-sync\" target=\"_blank\"\u003e\u003cimg src=\"https://poser.pugx.org/nullthoughts/laravel-data-sync/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.com/nullthoughts/laravel-data-sync\"\u003e\u003cimg src=\"https://api.travis-ci.com/nullthoughts/laravel-data-sync.svg?branch=master\" alt=\"Travis CI Build Status: Master\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Laravel Data Sync\n\nLaravel utility to keep records synchronized between environments through source control\n\n## [V3.1 branch](https://github.com/nullthoughts/laravel-data-sync/tree/v3.1) Notes (Work in progress)\n- Adds support for Laravel 8+ models directory in `config/data-sync.php`:\n```\n'namespace' =\u003e '\\\\App\\\\Models\\\\',\n```\n\n- Adds ability to export existing Models to data sync files:\n```\nphp artisan data:export User --criteria=name --criteria=email --except=id\n```\n\nwhich generates\n\n```json\n[\n    {\n        \"_name\": \"Cameron Frye\",\n        \"properties-\u003etitle\": \"Best Friend\",\n        \"phone_numbers-\u003emobile\": \"555-555-5556\",\n        \"_email\": \"noreply@buellerandco.com\",\n    }\n]\n```\n\n- Further work is required to support remote disks. For testing \u0026 development of new V3.1 features, use `composer require nullthoughts/laravel-data-sync:v3.1.x-dev`\n\n---\n\n## Installation \nYou can install this package via composer:\n```bash\ncomposer require nullthoughts/laravel-data-sync\n``` \n\nOr add this line in your `composer.json`, inside of the `require` section:\n\n``` json\n{\n    \"require\": {\n        \"nullthoughts/laravel-data-sync\": \"^1.0\",\n    }\n}\n```\nthen run ` composer install `\n\n## Usage\n- 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)\n- Create a JSON file for each model, using the model name as the filename. Example: Product.json would update the Product model\n- Use nested arrays in place of hardcoded IDs for relationships\n- Run `php artisan data:sync` (or `php artisan data:sync --model={model}` with the model flag to specify a model)\n\n### Optional\nIf using Laravel Forge, you can have the data sync run automatically on deploy. Edit your deploy script in Site -\u003e App to include:\n```\nif [ -f artisan ]\nthen\n    php artisan migrate --force\n    php artisan data:sync\nfi\n```\n\n## Notes\n- use studly case for model name relationships as JSON keys (example: 'option_group' =\u003e 'OptionGroup'). This is important for case sensitive file systems.\n- empty values are skipped\n- the criteria/attributes for updateOrCreate are identified with a leading underscore\n- nested values represent relationships and are returned using where($key, $value)-\u003efirst()-\u003eid\n- order of import can be set in _config/data-sync.php_ with an array:\n```\nreturn [\n    'path' =\u003e base_path('sync'),\n    'order' =\u003e [\n        'Role',\n        'Supervisor',\n    ]\n];\n```\n\n## Examples\n### User.json:\n```json\n[\n    {\n        \"name\": \"Ferris Bueller\",\n        \"properties-\u003etitle\": \"Leisure Consultant\",\n        \"phone_numbers-\u003emobile\": \"555-555-5555\",\n        \"phone_numbers-\u003eoffice\": \"\",\n        \"_email\": \"ferris@buellerandco.com\",\n        \"department\": {\n            \"name\": \"Management\",\n            \"location\": {\n                \"name\": \"Chicago\"\n            }\n        }\n    }\n]\n```\n\ntranslates to...\n\n```php\nUser::updateOrCreate([\n    'email' =\u003e 'ferris@buellerandco.com',\n],[\n    'name' =\u003e 'Ferris Bueller',\n    'properties-\u003etitle' =\u003e 'Leisure Consultant',\n    'phone_numbers-\u003emobile' =\u003e '555-555-5555',\n    'department_id' =\u003e Department::where('name', 'Management')\n                        -\u003ewhere('location_id', Location::where('name', 'Chicago')-\u003efirst()-\u003eid)\n                        -\u003efirst()\n                        -\u003eid,\n]);\n```\n\n### Role.json:\n```json\n[\n    {\n        \"_slug\": \"update-student-records\"\n    },\n    {\n        \"_slug\": \"borrow-ferrari\"\n    },\n    {\n        \"_slug\": \"destroy-ferrari\"\n    }\n]\n```\n\ntranslates to...\n\n```php\n    Role::updateOrCreate(['slug' =\u003e 'update-student-records']);\n\n    Role::updateOrCreate(['slug' =\u003e 'borrow-ferrari']);\n\n    Role::updateOrCreate(['slug' =\u003e 'destroy-ferrari']);\n```\n\n### RoleUser.json (pivot table with model):\n```json\n[\n    {\n        \"_user\": {\n            \"email\": \"ferris@buellerandco.com\"\n        },\n        \"_role\": {\n            \"slug\": \"update-student-records\"\n        }\n    },\n    {\n        \"_user\": {\n            \"email\": \"ferris@buellerandco.com\"\n        },\n        \"_role\": {\n            \"slug\": \"borrow-ferrari\"\n        }\n    },\n    {\n        \"_user\": {\n            \"email\": \"ferris@buellerandco.com\"\n        },\n        \"_role\": {\n            \"slug\": \"destroy-ferrari\"\n        }\n    }\n]\n```\n\ntranslates to...\n\n```php\n    RoleUser::updateOrCreate([\n        'user_id' =\u003e User::where('email', 'ferris@buellerandco.com')-\u003efirst()-\u003eid,\n        'role_id' =\u003e Role::where('slug', 'update-student-records')-\u003efirst()-\u003eid,\n    ]);\n\n    RoleUser::updateOrCreate([\n        'user_id' =\u003e User::where('email', 'ferris@buellerandco.com')-\u003efirst()-\u003eid,\n        'role_id' =\u003e Role::where('slug', 'borrow-ferrari')-\u003efirst()-\u003eid,\n    ]);\n\n    RoleUser::updateOrCreate([\n        'user_id' =\u003e User::where('email', 'ferris@buellerandco.com')-\u003efirst()-\u003eid,\n        'role_id' =\u003e Role::where('slug', 'destroy-ferrari')-\u003efirst()-\u003eid,\n    ]);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullthoughts%2Flaravel-data-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullthoughts%2Flaravel-data-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullthoughts%2Flaravel-data-sync/lists"}