use FD\Dispatcher\EventDispatcher; $dispatcher = new EventDispatcher(); $dispatcher->addListener('event.name', function ($event) { // Handle event }); $dispatcher->dispatch('event.name', $event);In the example above, we create a new instance of the EventDispatcher class and add a listener for an event with name 'event.name'. When the event is later dispatched with the same name, the listener function is executed. The package library for PHP FD Dispatcher is 'fd/dispatcher'.