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

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

phasync/http-client
===================

An async PSR-18 HTTP Client implementation.

1.0.0(2y ago)83.0k↓47.1%1MITPHP

Since Jun 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/phasync/http-client)[ Packagist](https://packagist.org/packages/phasync/http-client)[ RSS](/packages/phasync-http-client/feed)WikiDiscussions main Synced 3d ago

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

phasync/http-client
===================

[](#phasynchttp-client)

The phasync HTTP Client is a powerful, fiber-based HTTP client for PHP, leveraging the concurrency features of PHP Fibers to manage non-blocking requests efficiently. This client is compliant with PSR-18 and allows extensive configuration via cURL options to tailor request handling according to your needs.

Features
--------

[](#features)

- **Concurrent HTTP requests**: Utilizes PHP fibers to perform non-blocking HTTP requests.
- **Full PSR-18 compatibility**: Fully compliant with the PSR-18 interface for HTTP clients.
- **Extensive configuration**: Customize every aspect of HTTP requests using a wide range of cURL options.

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

[](#installation)

Use Composer to install the Phasync HTTP Client in your project:

```
composer require phasync/http-client
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Here is a simple example of making concurrent GET request:

```
use phasync\HttpClient\HttpClient;

$client = new HttpClient();
// Concurrent requests:
$response1 = $client->get('https://httpbin.org/get');
$response2 = $client->get('https://www.reddit.com/");
// All requests are performed in parallel using `curl_multi` under the hood.
echo $response1->getBody();
echo $resposne2->getBody();
```

### POST Request

[](#post-request)

To send a POST request with data:

```
$response = $client->post('https://httpbin.org/post', [
    'foo' => 'bar'
]);
echo $response->getBody();
```

### PSR-18 Client Usage

[](#psr-18-client-usage)

The client supports the PSR-18 client specification:

```
$psr7Response = $client->sendRequest($psr7Request);
```

### Handling Redirects

[](#handling-redirects)

Automatically handle redirects:

```
$client = new HttpClient([
    'followLocation' => true
]);
$response = $client->get('https://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com');
```

### Custom cURL Options

[](#custom-curl-options)

Customize client behavior by setting cURL options:

```
$client = new HttpClient([
    'timeoutMs' => 1000,
    'userAgent' => 'PhasyncClient/1.0'
]);
```

Configuration Options
---------------------

[](#configuration-options)

The `HttpClientOptions` class provides a way to configure a variety of options for handling requests:

- `userAgent`: Set the 'User-Agent' header.
- `timeoutMs`: Maximum number of milliseconds to allow cURL functions to execute.
- `followLocation`: Follow redirects.
- `sslVerifyPeer`: Verify the peer's SSL certificate.
- And many more detailed in the class definition.

Refer to the [`HttpClientOptions`](src/HttpClientOptions.php) class for a comprehensive list of all configurable options.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

739d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8822e0a14ce04a8f711d4ea933ea90aa005d9ee14827f05feac572c5601fb840?d=identicon)[frodeborli](/maintainers/frodeborli)

---

Top Contributors

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

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M7.0k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M92](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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