PageRenderTime 26ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/guzzlehttp/guzzle/README.md

https://gitlab.com/techniconline/kmc
Markdown | 90 lines | 69 code | 21 blank | 0 comment | 0 complexity | 39ea1ef18dc116a88f18d82233ad3ffd MD5 | raw file
  1. Guzzle, PHP HTTP client
  2. =======================
  3. [![Build Status](https://secure.travis-ci.org/guzzle/guzzle.svg?branch=master)](http://travis-ci.org/guzzle/guzzle)
  4. Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
  5. trivial to integrate with web services.
  6. - Simple interface for building query strings, POST requests, streaming large
  7. uploads, streaming large downloads, using HTTP cookies, uploading JSON data,
  8. etc...
  9. - Can send both synchronous and asynchronous requests using the same interface.
  10. - Uses PSR-7 interfaces for requests, responses, and streams. This allows you
  11. to utilize other PSR-7 compatible libraries with Guzzle.
  12. - Abstracts away the underlying HTTP transport, allowing you to write
  13. environment and transport agnostic code; i.e., no hard dependency on cURL,
  14. PHP streams, sockets, or non-blocking event loops.
  15. - Middleware system allows you to augment and compose client behavior.
  16. ```php
  17. $client = new GuzzleHttp\Client();
  18. $res = $client->request('GET', 'https://api.github.com/user', [
  19. 'auth' => ['user', 'pass']
  20. ]);
  21. echo $res->getStatusCode();
  22. // 200
  23. echo $res->getHeader('content-type');
  24. // 'application/json; charset=utf8'
  25. echo $res->getBody();
  26. // {"type":"User"...'
  27. // Send an asynchronous request.
  28. $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
  29. $promise = $client->sendAsync($request)->then(function ($response) {
  30. echo 'I completed! ' . $response->getBody();
  31. });
  32. $promise->wait();
  33. ```
  34. ## Help and docs
  35. - [Documentation](http://guzzlephp.org/)
  36. - [stackoverflow](http://stackoverflow.com/questions/tagged/guzzle)
  37. - [Gitter](https://gitter.im/guzzle/guzzle)
  38. ## Installing Guzzle
  39. The recommended way to install Guzzle is through
  40. [Composer](http://getcomposer.org).
  41. ```bash
  42. # Install Composer
  43. curl -sS https://getcomposer.org/installer | php
  44. ```
  45. Next, run the Composer command to install the latest stable version of Guzzle:
  46. ```bash
  47. composer.phar require guzzlehttp/guzzle
  48. ```
  49. After installing, you need to require Composer's autoloader:
  50. ```php
  51. require 'vendor/autoload.php';
  52. ```
  53. You can then later update Guzzle using composer:
  54. ```bash
  55. composer.phar update
  56. ```
  57. ## Version Guidance
  58. | Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 |
  59. |---------|-------------|---------------------|--------------|---------------------|---------------------|-------|
  60. | 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No |
  61. | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | N/A | N/A | No |
  62. | 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No |
  63. | 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes |
  64. [guzzle-3-repo]: https://github.com/guzzle/guzzle3
  65. [guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
  66. [guzzle-6-repo]: https://github.com/guzzle/guzzle
  67. [guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
  68. [guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
  69. [guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/