# reactphp/socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.

Repository: https://github.com/reactphp/socket
Canonical: https://ross.abutalabs.com/products/reactphp-socket
Homepage: https://reactphp.org/socket/
Language: PHP
License: MIT
License Family: permissive
Topics: php, reactphp, socket, server-socket
Last push: 2026-07-01T10:27:32+00:00

## Health v2 (maintenance only)
Score: 69/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 90, release rhythm 25, longevity 100
- inputs: {"age_days": 5228, "days_push": 63, "days_rel": 287, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1287, forks 158 (observed 2026-08-28T04:04:14.999486+00:00)

## What it is
A PHP library providing asynchronous, streaming plaintext TCP/IP and secure TLS socket server and client connections for the ReactPHP ecosystem. It offers reusable interfaces for building non-blocking network servers and clients on top of ReactPHP's EventLoop and Stream components.

## Use cases
- build an async tcp server in php
- create non-blocking socket client connections in php
- handle many concurrent network connections without blocking
- add a tls-encrypted socket server to a php application
- connect to a remote tcp service asynchronously with timeouts
- implement a custom binary protocol server in php
- use happy eyeballs dual-stack ipv4/ipv6 connection establishment in php

## When to choose
- You are building event-driven, non-blocking TCP or TLS servers or clients in PHP
- You need to handle many simultaneous socket connections without process/thread spawning
- You are already using ReactPHP components such as the event loop and streams
- You need composable connector layers for DNS resolution, timeouts, TLS, or Unix domain sockets

## When to avoid
- Your use case is a simple blocking script where plain fsockopen or cURL suffices
- You are building a standard HTTP API better served by a traditional PHP framework and web server
- Your team cannot work comfortably with callback/promise-based asynchronous code
- You need protocols outside TCP, TLS, or Unix sockets, such as raw UDP

## Facets
- artifact type: library
- maturity: stable
- function: networking, concurrency
- domain: networking, backend
- platform: php, cross-platform
- tags: async, tcp, tls, sockets, event-loop, reactphp, non-blocking, socket-server, socket-client, streaming, unix-domain-sockets, happy-eyeballs, ipv6

## Member repositories
- reactphp/socket (main) score 69

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:14.999486+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:56:06.479777+00:00, confidence not recorded.
  - readme: https://github.com/reactphp/socket (fetched 2026-08-28T04:04:14.999486+00:00, sha 09f37212e214)
  - homepage: https://reactphp.org/socket/ (fetched 2026-08-29T12:11:58.978794+00:00, sha 02e196e2297d)
  - site_page: https://reactphp.org/changelog.html (fetched 2026-08-29T12:11:58.989346+00:00, sha accf57fc05ce)
  - site_page: https://reactphp.org/socket/changelog.html (fetched 2026-08-29T12:11:58.992837+00:00, sha 55094bdbe310)
- Data as of 2026-08-30T08:39:29.467469+00:00.
