2017 © Pedro Peláez
 

library async_http_client

This simple client permits to execute multiple request in parallel, in a non blocking way.

image

cnastasi/async_http_client

This simple client permits to execute multiple request in parallel, in a non blocking way.

  • Wednesday, March 29, 2017
  • by cnastasi
  • Repository
  • 3 Watchers
  • 1 Stars
  • 12 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

SensioLabsInsight Code Climate Build Status Scrutinizer Code Quality Code Coverage, (*1)

Async Http Client

This simple client permits to execute multiple request in parallel, in a non blocking way., (*2)

Prerequisites

  • composer
  • php >=5.6

Installation

composer require cnastasi\async_http_client, (*3)

Usage


use AsyncHttpClient\Core\AsyncHttpClient; use AsyncHttpClient\Core\AsyncHttpClientDefault; use AsyncHttpClient\Helper\TimeDefault; use AsyncHttpClient\Logger\AsyncHttpLoggerDefault; use AsyncHttpClient\Service\AsyncHttpGenericService; $loop = \React\EventLoop\Factory::create(); $dnsResolverFactory = new \React\Dns\Resolver\Factory(); $dnsResolver = $dnsResolverFactory->createCached('8.8.8.8', $loop); $factory = new \React\HttpClient\Factory(); $client = $factory->create($loop, $dnsResolver); $logger = new AsyncHttpLoggerDefault(new TimeDefault()); $asyncClient = new AsyncHttpClientDefault($client, $loop, $logger); $service = new AsyncHttpGenericService('GET', 'http://www.google.it', null, function ($data, $request) { // Do something }); $anotherService = new AsyncHttpGenericService('POST', 'http://www.another.service.com', http_build_query(['postfield1' => 'value']) , function ($data, $request) { // Do something more }); $asyncClient->addService($service); $asyncClient->addService($anotherService); $asyncClient->send(); // code execution will block here and the HTTP calls will be dispatched in parallel // the code execution will continue only after all http calls are dispatched and returned (callback called) // do other stuff here

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

That's the way how I survived the last Christmas :P, (*4)

Credits

Thanks to Fabio Lombardo, (*5)

License

MIT License, (*6)

The Versions

29/03 2017

dev-master

9999999-dev

This simple client permits to execute multiple request in parallel, in a non blocking way.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Nastasi

23/03 2017

dev-dev_content_support

dev-dev_content_support

This simple client permits to execute multiple request in parallel, in a non blocking way.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Nastasi

28/12 2016

v0.4.1

0.4.1.0

This simple client permits to execute multiple request in parallel, in a non blocking way.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Nastasi

28/12 2016

v0.4

0.4.0.0

This simple client permits to execute multiple request in parallel, in a non blocking way.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Nastasi

27/12 2016

dev-dev_fabio

dev-dev_fabio

This simple client permits to execute multiple request in parallel, in a non blocking way.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Nastasi