PHP code example of jackiedo / laravel-pusher

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

    

jackiedo / laravel-pusher example snippets


...
'providers' => array(
    ...
    Jackiedo\LaravelPusher\PusherServiceProvider::class,
),

'Pusherer' => Jackiedo\LaravelPusher\Facades\Pusherer::class,

Pusherer::trigger('my-channel', 'my-event', ['message' => $message]);
// We're done here - how easy was that, it just works!

Pusherer::getSettings();
// This example is simple and there are far more methods available.

// Writing this…
Pusherer::connection('main')->log('They see me logging…');

// …is identical to writing this
Pusherer::log('They hatin…');

// and is also identical to writing this.
Pusherer::connection()->log('Tryin to catch me testing dirty…');

// This is because the main connection is configured to be the default.
Pusherer::getDefaultConnection(); // This will return main.

// We can change the default connection.
Pusherer::setDefaultConnection('alternative'); // The default is now alternative.

use Jackiedo\LaravelPusher\PusherManager;

class Foo
{
    protected $pusher;

    public function __construct(PusherManager $pusher)
    {
        $this->pusher = $pusher;
    }

    public function bar()
    {
        $this->pusher->trigger('my-channel', 'my-event', ['message' => $message]);
    }
}

App::make('Foo')->bar();