// Create a new event object $event = new Event(); // Set the name of the event to "button click" $event->setName('button click');
// Create a new event object $event = new Event(); // Set the name of the event to "form submit" $event->setName('form submit'); // Dispatch the event using the Symfony EventDispatcher library $dispatcher = new EventDispatcher(); $dispatcher->dispatch('form submit', $event);This example creates a new event object and sets its name to "form submit". It then uses the Symfony EventDispatcher library to dispatch the event. Package Library: PHP Event is a standalone package library for fired events and listeners written in PHP.