winzana / functional-event
Implement Symfony event with Annotation
Installs: 3 277
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=7.1
- doctrine/annotations: ^1.0
- symfony/dependency-injection: ^3.4 || ^4.0
- symfony/event-dispatcher: ^3.4 || ^4.0
- symfony/finder: ^3.4 || ^4.0
- symfony/http-kernel: ^3.4 || ^4.0
This package is auto-updated.
Last update: 2024-04-27 22:40:05 UTC
README
Symfony functional Event Bundle
Install
Create a config file config/packages/winzana_model_event.yaml
.
event: mapping: paths: ['%kernel.project_dir%/src/CommandHandler']
Add bundle into config\bundles.php
.
<?php return [ Winzana\Core\Event\EventBundle::class => ['all' => true], ];
Example
In your CommandHandler directory.
<?php namespace App\CommandHandler; use Winzana\Core\Event\Annotation\Event; use Winzana\Core\Event\Interfaces\EventInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; /** * Class CreateUserCommandHandler * @Event() */ final class CreateUserCommandHandler implements EventInterface { public function __invoke(GetResponseEvent $event) { // TODO: Implement __invoke() method. } public function getEventName(): string { return 'kernel.request'; } public function getPriority(): int { return 10; } }