Class 'Guzzle\Http\Client' 未找到

Class 'Guzzle\Http\Client' not found

我正在尝试在站点 http://www.sitepoint.com/guzzle-php-http-client/ , I followed the installation step by step here http://docs.guzzlephp.org/en/latest/overview.html#installation 上跟进本教程,我正在尝试 运行 第一个简单示例,但它给我带来了问题。我还检查了我的 PHP 版本要求(5.5):我的是 5.6,所以没问题。

我正在使用 MAC,请参阅下面的代码。

error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'vendor/autoload.php';

use Guzzle\Http\Client;
use Guzzle\Http\EntityBody;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;

$client = new Client("https://qrng.anu.edu.au");

$request = $client->get('/API/jsonI.php?length=10&type=uint8');

$response = $request->send();

echo $body = $response->getBody(true);

拜托,我错过了什么?

是,

use GuzzleHttp\Client;

您的以下教程似乎是基于 Guzzle 3.7 并且您已经安装了 Guzzle 6

Learn more.