<?php
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent as Event;
// event listeners
$eventListener1 = function (Event $event) {
echo 'Call me' . PHP_EOL;
};
$eventListener2 = function (Event $event) {
echo 'Call me too' . PHP_EOL;
};
// add listeners to EventDispatcher
$dispatcher = new EventDispatcher();
$dispatcher->addListener('callme', $eventListener1, 2);
$dispatcher->addListener('callme', $eventListener2, 3);
// priority of "callme" event
dump($dispatcher->getListenerPriority('callme', $eventListener2));
$dispatcher->dispatch(new Event(), 'callme');