winzana / functional-event
Implement Symfony event with Annotation
v0.1.2
2019-06-27 11:37 UTC
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: 2026-02-28 02:34:31 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; } }