'GuzzleHttp\Collection' 未找到
'GuzzleHttp\Collection' not found
我正在尝试 use this Google Analytics API tutorial,但这取决于 Guzzle。我收到此错误:
Fatal error: Class 'GuzzleHttp\Collection' not found in ../google-api-php-client/src/Google/Client.php on line 93
但我已经安装了 Guzzle:
>>php composer.phar require guzzlehttp/guzzle:~5.2
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing react/promise (v2.2.1)
Downloading: 100%
- Installing guzzlehttp/streams (3.0.0)
Downloading: 100%
- Installing guzzlehttp/ringphp (1.1.0)
Downloading: 100%
- Installing guzzlehttp/guzzle (5.3.0)
Downloading: 100%
Writing lock file
Generating autoload files
这是我的 composer.json:
"require": {
"php": ">=5.4",
"google/auth": "v0.3",
"monolog/monolog": "^1.17",
"phpseclib/phpseclib": "~2.0",
"guzzlehttp/guzzle": "5.3.*"
},
您必须包含 Composer 的自动加载文件,如下所述:https://getcomposer.org/doc/01-basic-usage.md#autoloading
在您的主文件中,在顶部添加以下行(在需要这些文件的任何代码之前):
require __DIR__ . '/vendor/autoload.php';
我正在尝试 use this Google Analytics API tutorial,但这取决于 Guzzle。我收到此错误:
Fatal error: Class 'GuzzleHttp\Collection' not found in ../google-api-php-client/src/Google/Client.php on line 93
但我已经安装了 Guzzle:
>>php composer.phar require guzzlehttp/guzzle:~5.2
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing react/promise (v2.2.1)
Downloading: 100%
- Installing guzzlehttp/streams (3.0.0)
Downloading: 100%
- Installing guzzlehttp/ringphp (1.1.0)
Downloading: 100%
- Installing guzzlehttp/guzzle (5.3.0)
Downloading: 100%
Writing lock file
Generating autoload files
这是我的 composer.json:
"require": {
"php": ">=5.4",
"google/auth": "v0.3",
"monolog/monolog": "^1.17",
"phpseclib/phpseclib": "~2.0",
"guzzlehttp/guzzle": "5.3.*"
},
您必须包含 Composer 的自动加载文件,如下所述:https://getcomposer.org/doc/01-basic-usage.md#autoloading
在您的主文件中,在顶部添加以下行(在需要这些文件的任何代码之前):
require __DIR__ . '/vendor/autoload.php';