PHP code example of notf0und / binance-ws

1. Go to this page and download the library: Download notf0und/binance-ws 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/ */

    

notf0und / binance-ws example snippets


namespace App\Listeners;

class MyCustomEventListener
{

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle($event)
    {
        Log::info($event->payload);
    }
}


 php
// App\Providers\EventServiceProvider.php

use Notf0und\BinanceWS\Events\MessageReceived;
use App\Listeners\MyCustomEventListener;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        MessageReceived::class => [
            MyCustomEventListener::class
        ]
    ];