zarganwar / symfony-event-dispatcher-utils
description
0.2.1
2024-11-25 12:35 UTC
Requires
- php: >=8.0
Requires (Dev)
- nette/tester: ^2.5
- phpstan/phpstan: ^2.0
README
composer require zarganwar/symfony-event-dispatcher-utils
Usage
- Install this lib
- Create Subscriber with __invoke method and with typed $event parameter
- Type of parameter must be a class, interface or union types
- Declare use Trait from this package
- Enjoy 😉
Example
class CoolSubscriber implements Symfony\Component\EventDispatcher\EventSubscriberInterface { use Zarganwar\SymfonyEventDispatcherUtils\AutoEventSubscriberTrait; public function __invoke(CoolEvent $event): void { // Be Cool } }