allow_url_fopen 必须在php.ini中启用。注解
如果没有安装cURL,Guzzle处理HTTP请求的时候不再使用cURL,而是使用PHP流处理,或者你也可以提供自己的发送HTTP请求的处理方式。
推荐使用 Composer 来安装Guzzle,Composer是PHP的依赖管理工具,允许你在项目中声明依赖关系,并安装这些依赖。
# 安装 Composer
curl -sS https://getcomposer.org/installer | php
你可以使用 composer.phar 客户端将Guzzle作为依赖添加到项目:
php composer.phar require guzzlehttp/guzzle:~6.0
或者,你可以编辑项目中已存在的 `composer.json 文件,添加 Guzzle 作为依赖:
{
"require": {
"guzzlehttp/guzzle": "~6.0"
}
}
安装完毕后,你需要引入Composer的自动加载文件:
require 'vendor/autoload.php';
你可以在 getcomposer.org 发现更多关于怎样安装Composer、配置自动加载以及其他有用的东西。
开发期间,你也可以安装 master 分支下的最新内容,只需要将Guzzle版本设置成 ~6.0@dev:
{
"require": {
"guzzlehttp/guzzle": "~6.0@dev"
}
}
使用基于 MIT许可 的许可证.
Copyright (c) 2015 Michael Dowling <https://github.com/mtdowling>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
为了做出贡献,你需要从GitHub检出源代码并使用Composer安装Guzzle的依赖:
git clone https://github.com/guzzle/guzzle.git
cd guzzle && curl -s http://getcomposer.org/installer | php && ./composer.phar install --dev
Guzzle是使用PHPUnit进行单元测试的。使用Makefile来运行测试:
make test
注解
你需要安装node.js v0.5.0或更高版本才能对Guzzle的HTTP处理器执行集成测试。