PHP code example of jalle19 / laravel-deferred-event-dispatcher
1. Go to this page and download the library: Download jalle19/laravel-deferred-event-dispatcher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jalle19 / laravel-deferred-event-dispatcher example snippets
// The event dispatcher must be a singleton
$app->singleton(\Jalle19\Laravel\Events\DeferredEventDispatcher::class, function () use ($app) {
return new \Jalle19\Laravel\Events\DeferredEventDispatcher($app, [
// Cache events
Illuminate\Cache\Events\CacheHit::class,
Illuminate\Cache\Events\CacheMissed::class,
]);
});
// Swap the default implementation for this one. Some classes type-hint the interface, others simply use "events"
$app->alias(\Jalle19\Laravel\Events\DeferredEventDispatcher::class, 'events');
$app->alias(\Jalle19\Laravel\Events\DeferredEventDispatcher::class, Illuminate\Contracts\Events\Dispatcher::class);