README.rst 1.4 KB

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