The recommended way to install Guzzle is with Composer. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add Guzzle as a dependency
php composer.phar require guzzle/guzzle:~3.9
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.
While you can always just rely on guzzle/guzzle, Guzzle provides several smaller parts of Guzzle as individual packages available through Composer.
Package name | Description |
---|---|
guzzle/common | Provides Guzzle\Common |
guzzle/http | Provides Guzzle\Http |
guzzle/parser | Provides Guzzle\Parser |
guzzle/batch | Provides Guzzle\Batch |
guzzle/cache | Provides Guzzle\Cache |
guzzle/inflection | Provides Guzzle\Inflection |
guzzle/iterator | Provides Guzzle\Iterator |
guzzle/log | Provides Guzzle\Log |
guzzle/plugin | Provides Guzzle\Plugin (all plugins) |
guzzle/plugin-async | Provides Guzzle\Plugin\Async |
guzzle/plugin-backoff | Provides Guzzle\Plugin\BackoffPlugin |
guzzle/plugin-cache | Provides Guzzle\Plugin\Cache |
guzzle/plugin-cookie | Provides Guzzle\Plugin\Cookie |
guzzle/plugin-error-response | Provides Guzzle\Plugin\ErrorResponse |
guzzle/plugin-history | Provides Guzzle\Plugin\History |
guzzle/plugin-log | Provides Guzzle\Plugin\Log |
guzzle/plugin-md5 | Provides Guzzle\Plugin\Md5 |
guzzle/plugin-mock | Provides Guzzle\Plugin\Mock |
guzzle/plugin-oauth | Provides Guzzle\Plugin\Oauth |
guzzle/service | Provides Guzzle\Service |
guzzle/stream | Provides Guzzle\Stream |
During your development, you can keep up with the latest changes on the master branch by setting the version requirement for Guzzle to dev-master.
{
"require": {
"guzzle/guzzle": "dev-master"
}
}
Guzzle can be installed through PEAR:
pear channel-discover guzzlephp.org/pear
pear install guzzle/guzzle
You can install a specific version of Guzzle by providing a version number suffix:
pear install guzzle/guzzle-3.9.0
In order to contribute, you'll need to checkout the source from GitHub and install Guzzle's dependencies using Composer:
git clone https://github.com/guzzle/guzzle.git
cd guzzle && curl -s http://getcomposer.org/installer | php && ./composer.phar install --dev
Guzzle is unit tested with PHPUnit. You will need to create your own phpunit.xml file in order to run the unit tests (or just copy phpunit.xml.dist to phpunit.xml). Run the tests using the vendored PHPUnit binary:
vendor/bin/phpunit
You'll need to install node.js v0.5.0 or newer in order to test the cURL implementation.
Bundles are available on GitHub:
A Guzzle Silex service provider is available on GitHub.