PHPackages                             zero-to-prod/stream-socket - 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. zero-to-prod/stream-socket

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

zero-to-prod/stream-socket
==========================

A wrapper for stream\_socket\_client()

v81.1.0(8mo ago)11.1k2MITPHPPHP &gt;=8.1CI passing

Since Sep 8Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/stream-socket)[ Packagist](https://packagist.org/packages/zero-to-prod/stream-socket)[ Docs](https://github.com/zero-to-prod/stream-socket)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-stream-socket/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (2)

Zerotoprod\\StreamSocket
========================

[](#zerotoprodstreamsocket)

[![](./art/logo.png)](./art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/stream-socket)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/279acb03233bc26d34e68536473b320b461a037abd2061808c2156353b01ba30/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73747265616d2d736f636b65742f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/stream-socket/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/3fd21dd444ab94210ad3319f8c8072298423def0e1efb3ba27cf032f6b6c9bcc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73747265616d2d736f636b65742f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/stream-socket/actions)[![Packagist Downloads](https://camo.githubusercontent.com/c21dd722df6ef0de47100bba90e05de67164e7809f199a06e644d488ce7ba5d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f73747265616d2d736f636b65743f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/stream-socket/stats)[![Packagist Version](https://camo.githubusercontent.com/2a42b3e876cb20d8fa4f00d32446a21847a55cf0b75d2a6d35debf704f6c951d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f73747265616d2d736f636b65743f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/stream-socket)[![GitHub repo size](https://camo.githubusercontent.com/cdd4c49efce8ca83ec857c22895aac131a632caabfe82e3a3c616a3eb5c54fc6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f7a65726f2d746f2d70726f642f73747265616d2d736f636b6574)](https://github.com/zero-to-prod/stream-socket)[![License](https://camo.githubusercontent.com/430c564930d734d9c55623fc95501398c9a8f645595d3c1e2422c1c4f6442b32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f73747265616d2d736f636b65743f636f6c6f723d726564)](https://github.com/zero-to-prod/stream-socket/blob/main/LICENSE.md)[![Hits-of-Code](https://camo.githubusercontent.com/aece97219de1dd687746f308468dc7ef1b704048dc664f26078d98ce7cd2e6f5/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f73747265616d2d736f636b65743f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/stream-socket/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

A wrapper for the [`stream_socket_client()`](https://www.php.net/manual/en/function.stream-stream-socket.php) method.

It provides classes that define all the options for this method.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

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

[](#installation)

Install `Zerotoprod\StreamSocket` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/stream-socket
```

This will add the package to your project’s dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/stream-socket)
vendor/bin/zero-to-prod-stream-socket

# Publish to custom directory
vendor/bin/zero-to-prod-stream-socket /path/to/your/docs
```

### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
  "scripts": {
    "post-install-cmd": [
      "zero-to-prod-stream-socket"
    ],
    "post-update-cmd": [
      "zero-to-prod-stream-socket"
    ]
  }
}
```

Usage
-----

[](#usage)

```
use Zerotoprod\StreamSocket\StreamSocket;

StreamSocket::client(
    'ssl://'.$url.':'. 443,
    30
    STREAM_CLIENT_CONNECT,
    stream_context_create()
);

echo $SocketClient->remoteSocketName(); // 34.223.124.45:443

$SocketClient->close();
```

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

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/stream-socket/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance59

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

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

Every ~29 days

Recently: every ~53 days

Total

13

Last Release

260d ago

Major Versions

v71.x-dev → v81.0.02025-01-28

PHP version history (3 changes)v71.0.0PHP ^7.1

v71.0.3PHP &gt;=7.1

v81.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (19 commits)")

---

Tags

phpstream-socketsocket-clientzero-to-prodstream-socket

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-stream-socket/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-stream-socket/health.svg)](https://phpackages.com/packages/zero-to-prod-stream-socket)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14226.2k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

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