jaggedsoft / php-binance-api

PHP Binance API is an asynchronous PHP library for the Binance API designed to be easy to use. https://github.com/binance-exchange/php-binance-api
MIT License
605 stars 497 forks source link

Bug: installed guzzle with version >= 7.3.0 leads to Call to undefined function GuzzleHttp\Psr7\uri_for() #460

Closed themazim closed 2 years ago

themazim commented 2 years ago

calling websocket based functions results in

System / tests tested on Linux and MacOs tested PHP Version 8.1 / 7.4

code

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

result

  Call to undefined function GuzzleHttp\Psr7\uri_for()

  at vendor/ratchet/pawl/src/Connector.php:126

Description Installing binance package in an application with guzzle 7.3 or higher or when upgrading, the above mentioned error is thrown.

This is a result of deprecating this function in guzzle and the currently used ratched/pawl version still uses uri_for. Newer Versions of pawl have the fix implemented.

Replacing with the officially suggested replacements, leads to infinite waiting (no message receives?).

//        $uri = gPsr\uri_for($url);
$uri = gPsr\Utils::uriFor($url);

Locking guzzle to 7.2 solves the issue for now.

Jay04653 commented 2 years ago

I would suggest updating the dependency in the project's composer.json file to "ratchet/pawl": "^0.4.0"