installation.rst 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ============
  2. Installation
  3. ============
  4. Requirements
  5. ------------
  6. #. PHP 5.3.3+ compiled with the cURL extension
  7. #. A recent version of cURL 7.16.2+ compiled with OpenSSL and zlib
  8. Installing Guzzle
  9. -----------------
  10. Composer
  11. ~~~~~~~~
  12. The recommended way to install Guzzle is with `Composer <http://getcomposer.org>`_. Composer is a dependency
  13. management tool for PHP that allows you to declare the dependencies your project needs and installs them into your
  14. project.
  15. .. code-block:: bash
  16. # Install Composer
  17. curl -sS https://getcomposer.org/installer | php
  18. # Add Guzzle as a dependency
  19. php composer.phar require guzzle/guzzle:~3.9
  20. After installing, you need to require Composer's autoloader:
  21. .. code-block:: php
  22. require 'vendor/autoload.php';
  23. You can find out more on how to install Composer, configure autoloading, and other best-practices for defining
  24. dependencies at `getcomposer.org <http://getcomposer.org>`_.
  25. Using only specific parts of Guzzle
  26. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  27. While you can always just rely on ``guzzle/guzzle``, Guzzle provides several smaller parts of Guzzle as individual
  28. packages available through Composer.
  29. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  30. | Package name | Description |
  31. +===============================================================================================+==========================================+
  32. | `guzzle/common <https://packagist.org/packages/guzzle/common>`_ | Provides ``Guzzle\Common`` |
  33. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  34. | `guzzle/http <https://packagist.org/packages/guzzle/http>`_ | Provides ``Guzzle\Http`` |
  35. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  36. | `guzzle/parser <https://packagist.org/packages/guzzle/parser>`_ | Provides ``Guzzle\Parser`` |
  37. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  38. | `guzzle/batch <https://packagist.org/packages/guzzle/batch>`_ | Provides ``Guzzle\Batch`` |
  39. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  40. | `guzzle/cache <https://packagist.org/packages/guzzle/cache>`_ | Provides ``Guzzle\Cache`` |
  41. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  42. | `guzzle/inflection <https://packagist.org/packages/guzzle/inflection>`_ | Provides ``Guzzle\Inflection`` |
  43. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  44. | `guzzle/iterator <https://packagist.org/packages/guzzle/iterator>`_ | Provides ``Guzzle\Iterator`` |
  45. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  46. | `guzzle/log <https://packagist.org/packages/guzzle/log>`_ | Provides ``Guzzle\Log`` |
  47. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  48. | `guzzle/plugin <https://packagist.org/packages/guzzle/plugin>`_ | Provides ``Guzzle\Plugin`` (all plugins) |
  49. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  50. | `guzzle/plugin-async <https://packagist.org/packages/guzzle/plugin-async>`_ | Provides ``Guzzle\Plugin\Async`` |
  51. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  52. | `guzzle/plugin-backoff <https://packagist.org/packages/guzzle/plugin-backoff>`_ | Provides ``Guzzle\Plugin\BackoffPlugin`` |
  53. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  54. | `guzzle/plugin-cache <https://packagist.org/packages/guzzle/plugin-cache>`_ | Provides ``Guzzle\Plugin\Cache`` |
  55. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  56. | `guzzle/plugin-cookie <https://packagist.org/packages/guzzle/plugin-cookie>`_ | Provides ``Guzzle\Plugin\Cookie`` |
  57. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  58. | `guzzle/plugin-error-response <https://packagist.org/packages/guzzle/plugin-error-response>`_ | Provides ``Guzzle\Plugin\ErrorResponse`` |
  59. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  60. | `guzzle/plugin-history <https://packagist.org/packages/guzzle/plugin-history>`_ | Provides ``Guzzle\Plugin\History`` |
  61. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  62. | `guzzle/plugin-log <https://packagist.org/packages/guzzle/plugin-log>`_ | Provides ``Guzzle\Plugin\Log`` |
  63. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  64. | `guzzle/plugin-md5 <https://packagist.org/packages/guzzle/plugin-md5>`_ | Provides ``Guzzle\Plugin\Md5`` |
  65. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  66. | `guzzle/plugin-mock <https://packagist.org/packages/guzzle/plugin-mock>`_ | Provides ``Guzzle\Plugin\Mock`` |
  67. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  68. | `guzzle/plugin-oauth <https://packagist.org/packages/guzzle/plugin-oauth>`_ | Provides ``Guzzle\Plugin\Oauth`` |
  69. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  70. | `guzzle/service <https://packagist.org/packages/guzzle/service>`_ | Provides ``Guzzle\Service`` |
  71. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  72. | `guzzle/stream <https://packagist.org/packages/guzzle/stream>`_ | Provides ``Guzzle\Stream`` |
  73. +-----------------------------------------------------------------------------------------------+------------------------------------------+
  74. Bleeding edge
  75. ^^^^^^^^^^^^^
  76. During your development, you can keep up with the latest changes on the master branch by setting the version
  77. requirement for Guzzle to ``dev-master``.
  78. .. code-block:: js
  79. {
  80. "require": {
  81. "guzzle/guzzle": "dev-master"
  82. }
  83. }
  84. PEAR
  85. ~~~~
  86. Guzzle can be installed through PEAR:
  87. .. code-block:: bash
  88. pear channel-discover guzzlephp.org/pear
  89. pear install guzzle/guzzle
  90. You can install a specific version of Guzzle by providing a version number suffix:
  91. .. code-block:: bash
  92. pear install guzzle/guzzle-3.9.0
  93. Contributing to Guzzle
  94. ----------------------
  95. In order to contribute, you'll need to checkout the source from GitHub and install Guzzle's dependencies using
  96. Composer:
  97. .. code-block:: bash
  98. git clone https://github.com/guzzle/guzzle.git
  99. cd guzzle && curl -s http://getcomposer.org/installer | php && ./composer.phar install --dev
  100. Guzzle is unit tested with PHPUnit. You will need to create your own phpunit.xml file in order to run the unit tests
  101. (or just copy phpunit.xml.dist to phpunit.xml). Run the tests using the vendored PHPUnit binary:
  102. .. code-block:: bash
  103. vendor/bin/phpunit
  104. You'll need to install node.js v0.5.0 or newer in order to test the cURL implementation.
  105. Framework integrations
  106. ----------------------
  107. Using Guzzle with Symfony
  108. ~~~~~~~~~~~~~~~~~~~~~~~~~
  109. Bundles are available on GitHub:
  110. - `DdeboerGuzzleBundle <https://github.com/ddeboer/GuzzleBundle>`_ for Guzzle 2
  111. - `MisdGuzzleBundle <https://github.com/misd-service-development/guzzle-bundle>`_ for Guzzle 3
  112. Using Guzzle with Silex
  113. ~~~~~~~~~~~~~~~~~~~~~~~
  114. A `Guzzle Silex service provider <https://github.com/guzzle/guzzle-silex-extension>`_ is available on GitHub.