PHPackages                             cnastasi/async\_http\_client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. cnastasi/async\_http\_client

ActiveLibrary

cnastasi/async\_http\_client
============================

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

v0.4.1(9y ago)122[1 issues](https://github.com/cnastasi/async_http_client/issues)MITHTMLPHP &gt;=5.6

Since Dec 27Pushed 9y ago3 watchersCompare

[ Source](https://github.com/cnastasi/async_http_client)[ Packagist](https://packagist.org/packages/cnastasi/async_http_client)[ RSS](/packages/cnastasi-async-http-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

[![SensioLabsInsight](https://camo.githubusercontent.com/de0a28fa6c19a0fd87b032746c60a4d93205cc4874d0fd0257a8f24f3c3f0b1d/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34386663393335312d653235612d346666392d383535392d6631303330303331613730372f6269672e706e67)](https://insight.sensiolabs.com/projects/48fc9351-e25a-4ff9-8559-f1030031a707)[![Code Climate](https://camo.githubusercontent.com/170519043f374b114a01b95ca84fc36913ba952c035de1d37b2a96411e7cf449/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f636e6173746173692f6173796e635f687474705f636c69656e742f6261646765732f6770612e737667)](https://codeclimate.com/github/cnastasi/async_http_client)[![Build Status](https://camo.githubusercontent.com/ce80d78fce9c2cdf77579f96e21b0bfb009289ad305e8f11ac49c4bf89ff202d/68747470733a2f2f7472617669732d63692e6f72672f636e6173746173692f6173796e635f687474705f636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cnastasi/async_http_client)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6e8eb6f2ce6ed0eb71184980f7f0f8680694e99e82a087427036fb8ff2c3413a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636e6173746173692f6173796e635f687474705f636c69656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cnastasi/async_http_client/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/12343be7ca196b234fb8ddfea837e2365982bbfff10e1035558eed1c2c724dfb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636e6173746173692f6173796e635f687474705f636c69656e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cnastasi/async_http_client/?branch=master)

Async Http Client
=================

[](#async-http-client)

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

Prerequisites
-------------

[](#prerequisites)

- composer
- php &gt;=5.6

Installation
------------

[](#installation)

`composer require cnastasi\async_http_client`

Usage
-----

[](#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
------------

[](#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
-------

[](#history)

That's the way how I survived the last Christmas :P

Credits
-------

[](#credits)

Thanks to [Fabio Lombardo](https://github.com/lombax85 "Fabio Lombardo github's page")

License
-------

[](#license)

[MIT License](https://github.com/cnastasi/async_http_client/blob/master/LICENSE)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10b75e2cb39cb0beafd94238c476a67ea60b23b102eb66d5068138a1114baa08?d=identicon)[cnastasi](/maintainers/cnastasi)

---

Top Contributors

[![cnastasi](https://avatars.githubusercontent.com/u/2204693?v=4)](https://github.com/cnastasi "cnastasi (23 commits)")[![lombax85](https://avatars.githubusercontent.com/u/1051056?v=4)](https://github.com/lombax85 "lombax85 (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cnastasi-async-http-client/health.svg)

```
[![Health](https://phpackages.com/badges/cnastasi-async-http-client/health.svg)](https://phpackages.com/packages/cnastasi-async-http-client)
```

###  Alternatives

[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41.5k328.9k1](/packages/ccxt-ccxt)[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.6M63](/packages/react-react)[react/socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP

1.3k116.9M402](/packages/react-socket)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[laravel-workflow/laravel-workflow

Durable workflow engine that allows users to write long running persistent distributed workflows (orchestrations) in PHP powered by Laravel queues.

1.2k446.6k6](/packages/laravel-workflow-laravel-workflow)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
