event-recorder
![Software License][ico-license]
, (*1)
Install
Via Composer, (*2)
``` bash
$ composer require jdr/event-recorder, (*3)
## Usage
To start recording domain events, implement the `ContainsRecordedEvents` interface. Optionally, you can use the `EventRecorderCapabilities` trait.
``` php
<?php
namespace JDR\App\Entity;
use JDR\EventRecorder\ContainsRecordedEvents;
use JDR\EventRecorder\EventRecorderCapabilities;
class Entity implements ContainsRecordedEvents
{
use EventRecorderCapabilities;
public function doSomething()
{
// ...
$this->record(new SomethingHappened());
}
}
$entity = new Entity();
$entity->doSomething();
// ...
$events = $entity->releaseEvents();
This package also contains a public event recorder., (*4)
``` php
<?php
namespace JDR\App;, (*5)
use JDR\EventRecorder\EventRecorder;, (*6)
$recorder = new EventRecorder();
$recorder->record(new SomethingHappened());, (*7)
// ..., (*8)
$events = $recorder->releaseEvents();, (*9)
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ bin/phpspec run
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*10)
Security
If you discover any security related issues, please email dev@johanderuijter.nl instead of using the issue tracker., (*11)
Credits
License
The MIT License (MIT). Please see License File for more information., (*12)