README.rst
47 lines
| 1 | ======= |
| 2 | RingPHP |
| 3 | ======= |
| 4 | |
| 5 | Provides a simple API and specification that abstracts away the details of HTTP |
| 6 | into a single PHP function. RingPHP be used to power HTTP clients and servers |
| 7 | through a PHP function that accepts a request hash and returns a response hash |
| 8 | that is fulfilled using a `promise <https://github.com/reactphp/promise>`_, |
| 9 | allowing RingPHP to support both synchronous and asynchronous workflows. |
| 10 | |
| 11 | By abstracting the implementation details of different HTTP clients and |
| 12 | servers, RingPHP allows you to utilize pluggable HTTP clients and servers |
| 13 | without tying your application to a specific implementation. |
| 14 | |
| 15 | .. code-block:: php |
| 16 | |
| 17 | <?php |
| 18 | require 'vendor/autoload.php'; |
| 19 | |
| 20 | use GuzzleHttp\Ring\Client\CurlHandler; |
| 21 | |
| 22 | $handler = new CurlHandler(); |
| 23 | $response = $handler([ |
| 24 | 'http_method' => 'GET', |
| 25 | 'uri' => '/', |
| 26 | 'headers' => [ |
| 27 | 'host' => ['www.google.com'], |
| 28 | 'x-foo' => ['baz'] |
| 29 | ] |
| 30 | ]); |
| 31 | |
| 32 | $response->then(function (array $response) { |
| 33 | echo $response['status']; |
| 34 | }); |
| 35 | |
| 36 | $response->wait(); |
| 37 | |
| 38 | RingPHP is inspired by Clojure's `Ring <https://github.com/ring-clojure/ring>`_, |
| 39 | which, in turn, was inspired by Python's WSGI and Ruby's Rack. RingPHP is |
| 40 | utilized as the handler layer in `Guzzle <http://guzzlephp.org>`_ 5.0+ to send |
| 41 | HTTP requests. |
| 42 | |
| 43 | Documentation |
| 44 | ------------- |
| 45 | |
| 46 | See http://ringphp.readthedocs.org/ for the full online documentation. |
| 47 |