Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grummfy/laravel-restorable-events
This library is an help to store and restore events for laravel.
https://github.com/grummfy/laravel-restorable-events
Last synced: about 1 month ago
JSON representation
This library is an help to store and restore events for laravel.
- Host: GitHub
- URL: https://github.com/grummfy/laravel-restorable-events
- Owner: Grummfy
- License: mit
- Created: 2018-01-22T22:47:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-29T23:28:59.000Z (almost 7 years ago)
- Last Synced: 2024-05-01T19:23:28.387Z (7 months ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel restorable events
This library is an help to store and restore events.
Compatible with laravel 5.5.
## Install
Install the dependencies
```
composer require grummfy/laravel-restorable-events
```Publish the configuration
```
php artisan vendor:publish --tag=config --provider=Grummfy\RestorableEvents\RestorableEventsProvider
```Create the model class, using the trait `EventStorableTrait`. See the example directory if you need it.
Edit your `Providers\EventServiceProvider.php`:
* Use the trait `EventServiceProviderTrait`
* You will also require to have this variable set, with at least theses values:
```php
protected $listen = [
JsonSerializableContract::class => [
StorableEventListener::class,
],
];
```This will allow the usage of the storage of the event on the fly.
## Usage
On any event you want to store, just extends `RestorableEvent` or implements the two interface `RestorableContract`, `JsonSerializableContract`.
The rest is made by the listener.If you need to hook some change, when an event is restored, just implements the `restored` method available on it.
If you require you could also prioritise the events. Just fill the `$priorities` value from the trait on the service listener.
### What's stored
In the event `CreditRefilled` is dispatched, it will be saved,
but for each eloquent model, only the id and the name of the model will be saved.## TODO
* unit test
* QA tools
* travis
* styleci
* scrutinizer
* ...