PHP code example of numesia / laravel-events

1. Go to this page and download the library: Download numesia/laravel-events 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/ */

    

numesia / laravel-events example snippets


    /**
     * Send an event to components
     *
     * @param      <string>     $eventName   The event name
     * @param      <string>     $eventData   The event data
     * @param      <mixed>      $components  The components
     * @param      <closure>    $callback    The callback
     */
    function nuEvent($eventName, $eventData, $components = null, $callback)


namespace App\Listeners;

use App\Jobs\SendNotification;

class NuEventSubscriber
{
    /**
     * Listening ActivityWasAborted event
     */
    public function onBookPing($event)
    {
        \Log::info($event);
    }

    /**
     * Register listeners for the subscriber
     *
     * @param Illuminate\Events\Dispatcher $events
     */
    public function subscribe($events)
    {
        $events->listen(
            'nuEvents:book.ping',
            'App\Listeners\NuEventSubscriber@onBookPing'
        );
    }