1. Go to this page and download the library: Download pusher/pusher-http-laravel 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/ */
pusher / pusher-http-laravel example snippets
// Triggering events.
$pusher->trigger('my-channel', 'my_event', 'hello world');
// Authenticating Private channels.
$pusher->socket_auth('my-channel', 'socket_id');
// Want to use the facade?
Pusher::get('/channels');
Pusher\Laravel\PusherServiceProvider::class
'Pusher' => Pusher\Laravel\Facades\Pusher::class
// You can alias this in config/app.php.
use Pusher\Laravel\Facades\Pusher;
Pusher::trigger('my-channel', 'my-event', ['message' => $message]);
// We're done here - how easy was that, it just works!
Pusher::getSettings();
// This example is simple and there are far more methods available.
use Pusher\Laravel\Facades\Pusher;
// Writing this…
Pusher::connection('main')->log('They see me logging…');
// …is identical to writing this
Pusher::log('They hatin…');
// and is also identical to writing this.
Pusher::connection()->log('Tryin to catch me testing dirty…');
// This is because the main connection is configured to be the default.
Pusher::getDefaultConnection(); // This will return main.
// We can change the default connection.
Pusher::setDefaultConnection('alternative'); // The default is now alternative.
use Pusher\Laravel\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();