PHPackages                             john-jun/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. john-jun/socket-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

john-jun/socket-client
======================

A simple socket client library

1.0.0(5y ago)0221MITPHPPHP ^7.1

Since Jun 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/john-jun/socket-client)[ Packagist](https://packagist.org/packages/john-jun/socket-client)[ RSS](/packages/john-jun-socket-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Socket Client
=============

[](#socket-client)

A simple socket client library

Install
-------

[](#install)

To install with composer

```
composer require john-jun/socket-client
```

Test
----

[](#test)

```
composer test
```

Usage
-----

[](#usage)

```
use Air\SocketClient\NetAddress\TcpNetAddress;
use Air\SocketClient\Socket;

$socketClient = new Socket(new TcpNetAddress('domain or ipv4', 443, true));

//connect & get connect use time
$socketClient->connect();
$socketClient->getConnectUseTime();

//http
$http = "GET /social/poster/share/xx HTTP/1.1\r\n";
$http .= "Host: dev-restful.moftech.net\r\n";
$http .= "Accept: */*\r\n";
$http .= "User-Agent: " . PHP_VERSION . "\r\n";
$http .= "Connection: keep-alive\r\n\r\n";

//send & recv
$socketClient->send($http);
$result = $socketClient->recv();

//the $result
'HTTP/1.1 200 OK
Cache-Control: no-cache, private
Content-Type: application/json
Date: Mon, 25 May 2020 09:58:00 GMT
Server: nginx
X-Powered-By: PHP/7.3.15
Content-Length: 26
Connection: keep-alive

{"code":"0","response":[]}';
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

2173d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b65af36c8e169e61b0d27ac07a278d01586cc01f007d0924a2d75a5d429671b?d=identicon)[John-Jun](/maintainers/John-Jun)

---

Top Contributors

[![john-jun](https://avatars.githubusercontent.com/u/10989387?v=4)](https://github.com/john-jun "john-jun (20 commits)")

---

Tags

Socketairsocket-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/john-jun-socket-client/health.svg)

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

###  Alternatives

[trafficcophp/bytebuffer

Node.js inspired byte stream buffer for PHP.

33437.2k17](/packages/trafficcophp-bytebuffer)[zoon/rialto

Manage Node resources from PHP

12199.4k3](/packages/zoon-rialto)[matviib/notifier

NO LIBRARIES socket per page bridge for your Laravel application.

621.2k](/packages/matviib-notifier)

PHPackages © 2026

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