PHPackages                             painless-php/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. painless-php/http-client

ActiveLibrary

painless-php/http-client
========================

PSR-18 Compliant HTTP client classes.

09PHP

Since Jul 9Pushed 10mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

http-client
===========

[](#http-client)

Http messaging related functionality, implementing psr-18.

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

[](#installation)

`composer require painless-php/http-client`

Public API
----------

[](#public-api)

#### General

[](#general)

- Client
- ClientRequest
- ClientResponse
- ParsedBody
- Redirection
- RequestSettings
- RequestResolution
- RequestResolutionCollection

#### Middleware

[](#middleware)

- RequestMiddlewareStack
- ResponseMiddlewareStack
- **RequestMiddleware** - Manipulate request before it is sent
    - LogRequest
- **ResponseMiddleware** - Manipulate response before it is returned
    - LogResponse
    - ParseResponseBody
    - ExpectResponseCode

#### Exceptions

[](#exceptions)

- **MessageException** - psr-18 compatible exceptions

    - ClientException
    - CommunicationException
        - RequestException
        - NetworkException
- **ResponseException** - response processing exceptions that can be created by middlewares

    - ResponseParsingException
    - ResponseContentException
    - UnexpectedStatusCodeException

Quickstart
----------

[](#quickstart)

```
use PainlessPHP\Http\Client\Client;

$client = new Client(
    settings: [
        'timeout' => 20,
        'maxRedirections' => 5
    ]
);

// Send a single request
$response = $client->request(
    method: 'GET',
    uri: 'https://google.com',
    body: 'foo',
    headers: [
        'content-type' => 'text/html'
    ]
);

// Use psr-17 to create a request
$request = $client->createRequest(
    method: 'GET',
    uri: 'https://google.com',
    body: 'foo',
    headers: [
        'content-type' => 'text/html'
    ]
);

// Send a psr-7 RequestInterface request
$client->sendRequest($request);

// Send multiple psr-7 RequestInterface requests
$resolutions = $client->sendRequests([
     $client->createRequest('GET', 'https://google.com?param=foo'),
     $client->createRequest('GET', 'https://google.com?param=bar'),
]);
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3839f3fb0c50b415aacf70b6cd2f41ff254d93af78dfd58e4e41e57aa5a676cb?d=identicon)[PainlessPHP](/maintainers/PainlessPHP)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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