php-binance-api.php
public function miniTicker(callable $callback)
    {
        $endpoint = '@miniticker';
        $this->subscriptions[$endpoint] = true;

        // @codeCoverageIgnoreStart
        // phpunit can't cover async function
        \Ratchet\Client\connect($this->stream . '!miniTicker@arr')->then(function ($ws) use ($callback, $endpoint) {
            $ws->on('message', function ($data) use ($ws, $callback, $endpoint) {
                if ($this->subscriptions[$endpoint] === false) {
                    //$this->subscriptions[$endpoint] = null;
                    $ws->close();
                    return; //return $ws->close();
                }
                $json = json_decode($data, true);
                $markets = [];
                foreach ($json as $obj) {
                    $markets[] = [
                        "symbol" => $obj['s'],
                        "close" => $obj['c'],
                        "open" => $obj['o'],
                        "high" => $obj['h'],
                        "low" => $obj['l'],
                        "volume" => $obj['v'],
                        "quoteVolume" => $obj['q'],
                        "eventTime" => $obj['E'],
                    ];
                }
                call_user_func($callback, $this, $markets);
            });
            $ws->on('close', function ($code = null, $reason = null) {
                // WPCS: XSS OK.
                echo "miniticker: WebSocket Connection closed! ({$code} - {$reason})" . PHP_EOL;
            });
        }, function ($e) {
            // WPCS: XSS OK.
            echo "miniticker: Could not connect: {$e->getMessage()}" . PHP_EOL;
        });
        // @codeCoverageIgnoreEnd
    }
public function miniTicker(callable $callback)
    {
        $endpoint = '@miniticker';
        $this->subscriptions[$endpoint] = true;

        // @codeCoverageIgnoreStart
        // phpunit can't cover async function
        \Ratchet\Client\connect($this->stream . '!miniTicker@arr')->then(function ($ws) use ($callback, $endpoint) {
            $ws->on('message', function ($data) use ($ws, $callback, $endpoint) {
                if ($this->subscriptions[$endpoint] === false) {
                    //$this->subscriptions[$endpoint] = null;
                    $ws->close();
                    return; //return $ws->close();
                }
                $json = json_decode($data, true);
                $markets = [];
                foreach ($json as $obj) {
                    $markets[] = [
                        "symbol" => $obj['s'],
                        "close" => $obj['c'],
                        "open" => $obj['o'],
                        "high" => $obj['h'],
                        "low" => $obj['l'],
                        "volume" => $obj['v'],
                        "quoteVolume" => $obj['q'],
                        "eventTime" => $obj['E'],
                    ];
                }
                call_user_func($callback, $this, $markets);
            });
            $ws->on('close', function ($code = null, $reason = null) {
                // WPCS: XSS OK.
                echo "miniticker: WebSocket Connection closed! ({$code} - {$reason})" . PHP_EOL;
            });
        }, function ($e) {
            // WPCS: XSS OK.
            echo "miniticker: Could not connect: {$e->getMessage()}" . PHP_EOL;
        });
        // @codeCoverageIgnoreEnd
    }
public function miniTicker ( callable $ callback ) { $ endpoint = '@miniticker' ; $ this -> subscriptions [ $ endpoint ] = true ; // @codeCoverageIgnoreStart // phpunit can't cover async function \ Ratchet \ Client \ connect ( $ this -> stream . '!miniTicker@arr' ) -> then ( function ( $ ws ) use ( $ callback , $ endpoint ) { $ ws -> on ( 'message' , function ( $ data ) use ( $ ws , $ callback , $ endpoint ) { if ( $ this -> subscriptions [ $ endpoint ] === false ) { //$this->subscriptions[$endpoint] = null; $ ws -> close ( ) ; return ; //return $ws->close(); } $ json = json_decode ( $ data , true ) ; $ markets = [ ] ; foreach ( $ json as $ obj ) { $ markets [ ] = [ "symbol" => $ obj [ 's' ] , "close" => $ obj [ 'c' ] , "open" => $ obj [ 'o' ] , "high" => $ obj [ 'h' ] , "low" => $ obj [ 'l' ] , "volume" => $ obj [ 'v' ] , "quoteVolume" => $ obj [ 'q' ] , "eventTime" => $ obj [ 'E' ] , ] ; } call_user_func ( $ callback , $ this , $ markets ) ; } ) ; $ ws -> on ( 'close' , function ( $ code = null , $ reason = null ) { // WPCS: XSS OK. echo "miniticker: WebSocket Connection closed! ({$code} - {$reason})" . PHP_EOL ; } ) ; } , function ( $ e ) { // WPCS: XSS OK. echo "miniticker: Could not connect: {$e->getMessage()}" . PHP_EOL ; } ) ; // @codeCoverageIgnoreEnd }
miniTicker Get miniTicker for all symbols

$api->miniTicker(function($api, $ticker) {
print_r($ticker);
});

@param $callback callable function closer that takes 2 arguments, $pai and $ticker data
@return null
miniTicker Get miniTicker for all symbols