zarganwar/symfony-event-dispatcher-utils

0.2.1 2024-11-25 12:35 UTC

This package is auto-updated.

Last update: 2024-12-18 14:48:57 UTC


README

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
    }

}