Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 582 Bytes

readme.md

File metadata and controls

31 lines (22 loc) · 582 Bytes

Installation

composer require zarganwar/symfony-event-dispatcher-utils

Usage

  1. Install this lib
  2. Create Subscriber with __invoke method and with typed $event parameter
  3. Type of parameter must be a class, interface or union types
  4. Declare use Trait from this package
  5. Enjoy 😉

Example

class CoolSubscriber implements Symfony\Component\EventDispatcher\EventSubscriberInterface
{
    use Zarganwar\SymfonyEventDispatcherUtils\AutoEventSubscriberTrait;

    public function __invoke(CoolEvent $event): void
    {
        // Be Cool
    }

}