Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ventrec/laravel-entity-sync
Easily sync entities, when changes occur, to another project.
https://github.com/ventrec/laravel-entity-sync
laravel package php sync
Last synced: 19 days ago
JSON representation
Easily sync entities, when changes occur, to another project.
- Host: GitHub
- URL: https://github.com/ventrec/laravel-entity-sync
- Owner: ventrec
- License: mit
- Created: 2017-10-15T21:00:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T19:14:15.000Z (about 7 years ago)
- Last Synced: 2024-11-22T17:51:52.022Z (about 1 month ago)
- Topics: laravel, package, php, sync
- Language: PHP
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel entity sync
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ventrec/laravel-entity-sync.svg?style=flat-square)](https://packagist.org/packages/ventrec/laravel-entity-sync)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/ventrec/laravel-entity-sync/master.svg?style=flat-square)](https://travis-ci.org/ventrec/laravel-entity-sync)
[![Total Downloads](https://img.shields.io/packagist/dt/ventrec/laravel-entity-sync.svg?style=flat-square)](https://packagist.org/packages/ventrec/laravel-entity-sync)Easily sync entities, when changes occur, to another project.
## Introduction
This package is designed to sync entities from one laravel project to another, something that can be useful if you have a master and client setup.
For this to work, you will need to install the [client package](https://github.com/ventrec/laravel-entity-sync-endpoint) in the laravel project that you wish to sync your entities to.
## Installation
1. `composer require ventrec/laravel-entity-sync`
2. Add `Ventrec\LaravelEntitySync\LaravelEntitySyncProvider::class` to providers in app.php
3. Publish the config file `php artisan vendor:publish --provider="Ventrec\LaravelEntitySync\LaravelEntitySyncProvider"`
4. Update the config file
- Add the entities that you would like to monitor for changes to the config file.
- Enter the full url to the endpoint where the requests should go.
- Enter an api token that should be used to verify the requests
## UsageIn some cases you might have attributes on a model that you do not want to sync. For this you can define a method named `ignoreSyncAttributes` that returns an array containing the name of attributes you do not want to sync.
**Example**
In a User model you might want to exclude the password:
```php
public function ignoreSyncAttributes()
{
return ['password'];
}
```### Prevent observer from running while seeding
In order to prevent the observer from running while seeding, you have to disable the package in runtime.
In your `DatabaseSeeder` class, add the following line at the top of the `run()` method:
```php
config(['laravelEntitySync.enabled' => false]);
```
## LicenseThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.