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

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

zelenin/http-client
===================

PSR-18 compatible HTTP client with middleware support

4.0.1(7y ago)322.1k↓100%1[1 PRs](https://github.com/zelenin/http-client/pulls)2MITPHPPHP &gt;=7.1

Since Jan 11Pushed 6y ago3 watchersCompare

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

READMEChangelogDependencies (6)Versions (13)Used By (2)

HTTP client [![Build Status](https://camo.githubusercontent.com/32bb7702ddb22725837b7dd91639cb540b1d11e198d4d00a683bd6a3e6e5ae49/68747470733a2f2f7472617669732d63692e6f72672f7a656c656e696e2f687474702d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zelenin/http-client) [![Coverage Status](https://camo.githubusercontent.com/0a8d51984da7869d7d0c668122ac4cfac5e87f45e5fbc16d3e18a867af02a0a1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7a656c656e696e2f687474702d636c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/zelenin/http-client?branch=master)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#http-client--)

[PSR-18](http://www.php-fig.org/psr/psr-18/) compatible low-level HTTP client with middleware support.

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

[](#installation)

### Composer

[](#composer)

The preferred way to install this extension is through [Composer](http://getcomposer.org/).

Either run

```
php composer.phar require zelenin/http-client "~4.0.0"

```

or add

```
"zelenin/http-client": "~4.0.0"

```

to the `require` section of your `composer.json`

Usage
-----

[](#usage)

```
use Zelenin\HttpClient\ClientFactory;
use Zend\Diactoros\Request;
use Zend\Diactoros\Uri;

$client = (new ClientFactory())->create();

$request = new Request(new Uri('https://example.com/'), 'GET');
$response = $client->sendRequest($request);
```

### Full example with middleware stack

[](#full-example-with-middleware-stack)

```
use Zelenin\HttpClient\Middleware\Cookie\CookieRequest;
use Zelenin\HttpClient\Middleware\Cookie\CookieResponse;
use Zelenin\HttpClient\Middleware\Cookie\FileStorage;
use Zelenin\HttpClient\Middleware\Deflate;
use Zelenin\HttpClient\Middleware\UserAgent;
use Zelenin\HttpClient\MiddlewareClient;
use Zelenin\HttpClient\RequestConfig;
use Zelenin\HttpClient\Transport\CurlTransport;
use Zend\Diactoros\Request;
use Zend\Diactoros\ResponseFactory;
use Zend\Diactoros\StreamFactory;
use Zend\Diactoros\Uri;

$streamFactory = new StreamFactory();
$responseFactory = new ResponseFactory();

$cookieStorage = new FileStorage('/tmp/http-client/cookies.storage');

$client = new MiddlewareClient([
    new CookieRequest($cookieStorage),
    new UserAgent(sprintf('HttpClient PHP/%s', PHP_VERSION)),
    new Deflate($streamFactory),
    new CookieResponse($cookieStorage),
    new CurlTransport($streamFactory, $responseFactory, new RequestConfig()),
], $responseFactory);

$request = new Request(new Uri('https://example.com/'), 'GET');
$response = $client->sendRequest($request);
```

Author
------

[](#author)

[Aleksandr Zelenin](https://github.com/zelenin/), e-mail:

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

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 ~59 days

Recently: every ~90 days

Total

12

Last Release

2747d ago

Major Versions

0.1.0 → 1.0.02017-06-08

1.0.3 → 2.0.02018-03-20

2.0.0 → 3.0.02018-03-21

3.0.0 → 4.0.02018-10-31

PHP version history (2 changes)0.0.1PHP &gt;=7.0

4.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0de51e0d5cd7141a2189ae926d4a3c449d5d41fda7c6b63b08869eb3c1e53b9a?d=identicon)[zelenin](/maintainers/zelenin)

---

Top Contributors

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

---

Tags

clienthttpphppsr-7httppsr-7middlewareclientpsr-18

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[vultr/vultr-php

The Official Vultr API PHP Wrapper.

2243.9k1](/packages/vultr-vultr-php)[amphp/http-client-psr7

PSR-7 adapter for Amp's HTTP client.

1454.7k4](/packages/amphp-http-client-psr7)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1417.1k5](/packages/chillerlan-php-httpinterface)[art4/requests-psr18-adapter

Use WordPress/Requests as a PSR-18 HTTP client

153.3k](/packages/art4-requests-psr18-adapter)

PHPackages © 2026

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