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

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

php-http/socket-client
======================

Socket client for PHP-HTTP

2.4.0(4mo ago)812.5M—2.6%42[1 PRs](https://github.com/php-http/socket-client/pulls)20MITPHPPHP ^8.1CI passing

Since Dec 18Pushed 4mo ago11 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (18)Used By (20)

Socket Client for PHP HTTP
==========================

[](#socket-client-for-php-http)

[![Latest Version](https://camo.githubusercontent.com/1d6d6f85992ddb2ec6e89696a3115fadb483fa9d3d7ee0f4f64543d06da70a0c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d687474702f736f636b65742d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-http/socket-client/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://github.com/php-http/socket-client/actions/workflows/ci.yml/badge.svg?branch=2.x)](https://github.com/php-http/socket-client/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/deb07c560b8cf2f73be11854ee1228c4251d1effd963966fe199db6ca3034f9d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7068702d687474702f736f636b65742d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/php-http/socket-client)[![Quality Score](https://camo.githubusercontent.com/8d1fe8dec79f390b10a0dd01db86f3b8735e3275d5062462a2aa520439c199d9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7068702d687474702f736f636b65742d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/php-http/socket-client)[![Total Downloads](https://camo.githubusercontent.com/cd30e1d6cad8498e821ad05dcc723c33339b641a05f2b865212d72dcc62c76b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d687474702f736f636b65742d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-http/socket-client)

The socket client use the stream extension from PHP, which is integrated into the core.

Features
--------

[](#features)

- TCP Socket Domain (tcp://hostname:port)
- UNIX Socket Domain (unix:///path/to/socket.sock)
- TLS / SSL Encyrption
- Client Certificate (only for php &gt; 5.6)

Installation and Usage
----------------------

[](#installation-and-usage)

[Read the documentation at http://docs.php-http.org/en/latest/clients/socket-client.html](http://docs.php-http.org/en/latest/clients/socket-client.html)

Testing
-------

[](#testing)

First launch the http server:

```
$ ./vendor/bin/http_test_server > /dev/null 2>&1 &
```

Then generate SSL certificates:

```
$ composer gen-ssl
```

Note: If you are running this on macOS and get the following error: "Error opening CA Private Key privkey.pem", check [this](ssl-macOS.md) file.

Now run the test suite:

```
$ composer test
```

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

[](#contributing)

Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).

Security
--------

[](#security)

If you discover any security related issues, please contact us at .

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance76

Regular maintenance activity

Popularity58

Moderate usage in the ecosystem

Community43

Growing community involvement

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.2% 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 ~216 days

Recently: every ~310 days

Total

18

Last Release

128d ago

Major Versions

v0.2.0 → v1.0.02016-01-26

v1.4.1 → 2.0.0-beta12019-12-11

PHP version history (6 changes)v0.1.0PHP &gt;=5.4

v1.2.0PHP ^5.5 || ^7.0

2.0.0-beta1PHP ^7.1

2.1.0PHP &gt;=7.1

2.1.1PHP ^7.2 || ^8.0

2.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e4e105cea62b616d4cb376b08a849b6a428f646998537de150d16a8eb537b90?d=identicon)[mark.sagikazar](/maintainers/mark.sagikazar)

![](https://avatars.githubusercontent.com/u/76576?v=4)[David Buchmann](/maintainers/dbu)[@dbu](https://github.com/dbu)

![](https://www.gravatar.com/avatar/3fb6e13a139230893f783118651540d3d057979fd726fefd135b1b397873010e?d=identicon)[php-http](/maintainers/php-http)

---

Top Contributors

[![joelwurtz](https://avatars.githubusercontent.com/u/90466?v=4)](https://github.com/joelwurtz "joelwurtz (66 commits)")[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (20 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (19 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (3 commits)")[![flavioheleno](https://avatars.githubusercontent.com/u/471860?v=4)](https://github.com/flavioheleno "flavioheleno (2 commits)")[![dudek-pup](https://avatars.githubusercontent.com/u/93711255?v=4)](https://github.com/dudek-pup "dudek-pup (1 commits)")[![frenchcomp](https://avatars.githubusercontent.com/u/1397905?v=4)](https://github.com/frenchcomp "frenchcomp (1 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")[![mrmiagi](https://avatars.githubusercontent.com/u/1648085?v=4)](https://github.com/mrmiagi "mrmiagi (1 commits)")[![qkdreyer](https://avatars.githubusercontent.com/u/717869?v=4)](https://github.com/qkdreyer "qkdreyer (1 commits)")[![shieldz80](https://avatars.githubusercontent.com/u/148091884?v=4)](https://github.com/shieldz80 "shieldz80 (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (1 commits)")[![ajgarlag](https://avatars.githubusercontent.com/u/388184?v=4)](https://github.com/ajgarlag "ajgarlag (1 commits)")[![yeclense](https://avatars.githubusercontent.com/u/3920379?v=4)](https://github.com/yeclense "yeclense (1 commits)")[![andrew-demb](https://avatars.githubusercontent.com/u/12499813?v=4)](https://github.com/andrew-demb "andrew-demb (1 commits)")[![bastnic](https://avatars.githubusercontent.com/u/84887?v=4)](https://github.com/bastnic "bastnic (1 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (1 commits)")[![driehle](https://avatars.githubusercontent.com/u/1586788?v=4)](https://github.com/driehle "driehle (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[php-http/client-common

Common HTTP Client implementations and tools for HTTPlug

1.1k225.5M571](/packages/php-http-client-common)[kriswallsmith/buzz

Lightweight HTTP client

2.0k31.3M443](/packages/kriswallsmith-buzz)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

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

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

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)

PHPackages © 2026

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