cycle/entity-behavior
Adds behavior attributes to Cycle ORM entities (UUID, timestamps, soft delete, optimistic lock, hooks, event listeners) plus an API to build custom behaviors. Use EventDrivenCommandGenerator when creating the ORM to enable event-driven commands.
The package provides a collection of attributes that add behaviors to Cycle ORM entities. It also provides a convenient API to create custom behavior attributes.
The package is available via composer and can be installed using the following command:
composer require cycle/entity-behavior
After installation the package you need to create Cycle\ORM\ORM object with
passing \Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator generator object as third (commandGenerator)
argument.
Example
use Cycle\ORM\ORM;
use Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator;
// Application container (PSR-11 compatible).
// https://www.php-fig.org/psr/psr-11/
$container = new Container();
$commandGenerator = new EventDrivenCommandGenerator($schema, $container);
$orm = new ORM(
factory: $factory,
schema: $schema,
commandGenerator: $commandGenerator,
);
That's it. Now you can use all benefits of this package.
The MIT License (MIT). Please see LICENSE for more information. Maintained
by Spiral Scout.
How can I help you explore Laravel packages today?