PHPackages                             async-request/async-request - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. async-request/async-request

ActiveLibrary[HTTP &amp; Networking](/categories/http)

async-request/async-request
===========================

Asynchronous cURL library for PHP with reasonable API

v1.0.0(9y ago)2569.0k↓49.8%5[1 issues](https://github.com/MartinMajor/async-request/issues)[1 PRs](https://github.com/MartinMajor/async-request/pulls)MITPHPPHP &gt;=7.1.0

Since Oct 29Pushed 6y ago4 watchersCompare

[ Source](https://github.com/MartinMajor/async-request)[ Packagist](https://packagist.org/packages/async-request/async-request)[ RSS](/packages/async-request-async-request/feed)WikiDiscussions master Synced 2d ago

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

AsyncRequest
============

[](#asyncrequest)

> Asynchronous cURL library for PHP with reasonable API.

[![Build Status](https://camo.githubusercontent.com/6fc3f251814a3db6a9cf3b5d5d98ee8dcf9b0ebc118b9fe7129574fae669c100/68747470733a2f2f7472617669732d63692e6f72672f4d617274696e4d616a6f722f6173796e632d726571756573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/MartinMajor/async-request)[![Latest stable](https://camo.githubusercontent.com/6884c1a3bf56fecc72bb2b14862c4d66db5c1d5be8c27661d5ee3311e9b01be5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6173796e632d726571756573742f6173796e632d726571756573742e737667)](https://packagist.org/packages/async-request/async-request)[![License](https://camo.githubusercontent.com/20901bc0eb8b788a7ddff131e4f01e82e851a1ef7b62b84b29b5c7c001ff0a1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6173796e632d726571756573742f6173796e632d726571756573742e737667)](https://camo.githubusercontent.com/20901bc0eb8b788a7ddff131e4f01e82e851a1ef7b62b84b29b5c7c001ff0a1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6173796e632d726571756573742f6173796e632d726571756573742e737667)

PHP is by default single-thread language but when it comes to HTTP requests it is not very convenient to do them in serial. cURL implementation in PHP offers functions for multi requests but with terrible C-style API. This library wraps those functions into modern object-oriented event-driven API.

Requirements
------------

[](#requirements)

async-request/async-request version 1.x requires PHP 7.1+ with cUrl extension enabled.

If you are using PHP5.4+ you can use async-request/async-request version 0.x.

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

[](#installation)

You can easily install the newest version using [Composer](http://getcomposer.org/):

```
composer require async-request/async-request
```

Simple example
--------------

[](#simple-example)

```
$urls = [
	'http://www.example.com',
	'http://www.example.org',
];

$asyncRequest = new AsyncRequest\AsyncRequest();

foreach ($urls as $url) {
	$request = new AsyncRequest\Request($url);
	$asyncRequest->enqueue($request, function(AsyncRequest\Response $response) {
		echo $response->getBody() . "\n";
	});
}

$asyncRequest->run();
```

Advanced features
-----------------

[](#advanced-features)

You can specify number of requests that can run in parallel:

```
$asyncRequest->setParallelLimit(5);
```

You can add other requests in callback function:

```
$callback = function(AsyncRequest\Response $response, AsyncRequest\AsyncRequest $asyncRequest) {
	$asyncRequest->enqueue(new AsyncRequest\Request('http://www.example.com'));
};
```

You can specify priority of each request and requests with higher priority will be called first:

```
$asyncRequest->enqueueWithPriority(10, $request, $callback);
```

If you want to use some cURL options, it is as easy as this:

```
$request = new AsyncRequest\Request($url);
$request->setOption(CURLOPT_POST, true);
```

And if you want some special behavior or some additional data in `Response`, you can always create your own `Request` object by implementing `IRequest` interface.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

3

Last Release

3535d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.1.0

v0.1.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3585c9d277a40bedbf7afe93cbc9a6ef03a77a3aa7a2e0c64e8e3b44859c632b?d=identicon)[MartinMajor](/maintainers/MartinMajor)

---

Top Contributors

[![MartinMajor](https://avatars.githubusercontent.com/u/1373182?v=4)](https://github.com/MartinMajor "MartinMajor (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/async-request-async-request/health.svg)

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

###  Alternatives

[educoder/pest

A proper REST client for PHP.

358705.8k16](/packages/educoder-pest)[chuyskywalker/rolling-curl

Rolling-Curl: A non-blocking, non-dos multi-curl library for PHP

213461.0k6](/packages/chuyskywalker-rolling-curl)[unikent/curl

Laravel Curl Helper Library.

1242.8k](/packages/unikent-curl)

PHPackages © 2026

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