<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
psr-discovery / event-dispatcher-implementations example snippets
use PsrDiscovery\Discover;
// Return an instance of the first discovered PSR-14 Event Dispatcher implementation.
$eventDispatcher = Discover::eventDispatcher();
// Send a request using the discovered Event Dispatcher.
eventDispatcher->dispatch(...);
use PsrDiscovery\Discover;
$eventDispatcher = Discover::eventDispatcher();
if ($eventDispatcher === null) {
// No suitable Event Dispatcher implementation was discovered.
// Fall back to a default implementation.
$eventDispatcher = new DefaultEventDispatcher();
}
use PsrDiscovery\Discover;
use PsrDiscovery\Implementations\Psr14\EventDispatchers;
// Prefer the a specific implementation of PSR-14 over others.
EventDispatchers::prefer('league/event');
// Return an instance of League\Event\Dispatcher,
// or the next available from the list of candidates,
// Returns null if none are discovered.
$dispatcher = Discover::eventDispatcher();
use PsrDiscovery\Discover;
use PsrDiscovery\Implementations\Psr14\EventDispatchers;
// Only discover a specific implementation of PSR-14.
EventDispatchers::use('league/event');
// Return an instance of League\Event\Dispatcher,
// or null if it is not available.
$dispatcher = Discover::eventDispatcher();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.