# reactphp/socket

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/reactphp-socket).**

1,285 stars · 158 forks · PHP · MIT

## Links

- GitHub: https://github.com/reactphp/socket
- Homepage: https://reactphp.org/socket/
- awesome-repositories: https://awesome-repositories.com/repository/reactphp-socket.md

## Topics

`php` `reactphp` `server-socket` `socket`

## Description

This library provides a framework for building event-driven, non-blocking network applications in PHP. It enables the development of asynchronous TCP and TLS servers and clients that manage multiple concurrent connections without stalling the main execution thread. By utilizing an event-loop architecture, the library handles network operations and data exchange through asynchronous streams, ensuring that the application remains responsive during high-throughput tasks.

The project distinguishes itself through its integration with operating system primitives, such as raw file descriptors and Unix domain sockets, which facilitate efficient inter-process communication and compatibility with external process managers. It incorporates advanced connection management features, including automated timeout handling, concurrent connection limits, and latency-reducing optimizations like IPv6 prioritization and domain name lookup caching.

The library covers a broad range of networking capabilities, including secure encrypted communication, incremental data streaming, and non-blocking hostname resolution. These features are exposed through promise-based interfaces, allowing for the orchestration of complex network handshakes and data transfers while maintaining low memory overhead.

## Tags

### Networking & Communication

- [Asynchronous Socket Libraries](https://awesome-repositories.com/f/networking-communication/asynchronous-socket-libraries.md) — Provides a non-blocking library for building event-driven TCP and TLS socket servers and clients using asynchronous streams in PHP.
- [Asynchronous Network Frameworks](https://awesome-repositories.com/f/networking-communication/asynchronous-network-frameworks.md) — Provides a toolkit for handling high-performance network communication and secure encrypted connections through an event-loop architecture.
- [Asynchronous Network Servers](https://awesome-repositories.com/f/networking-communication/asynchronous-network-servers.md) — Builds high-performance, non-blocking TCP and TLS servers that handle many concurrent client connections without stalling the main application process.
- [Event-Driven Networking](https://awesome-repositories.com/f/networking-communication/event-driven-networking.md) — Provides a framework for managing concurrent network connections and data streams without blocking the main execution thread of an application.
- [Secure Communication Channels](https://awesome-repositories.com/f/networking-communication/secure-communication-channels.md) — Provides cryptographic handshakes on standard socket streams to establish encrypted communication channels. ([source](https://github.com/reactphp/socket/blob/3.x/CHANGELOG.md))
- [Non-Blocking Socket I/O](https://awesome-repositories.com/f/networking-communication/socket-networking/non-blocking-socket-i-o.md) — Utilizes system-level non-blocking socket calls to initiate and accept connections without stalling the application execution flow.
- [Asynchronous Network Clients](https://awesome-repositories.com/f/networking-communication/asynchronous-network-clients.md) — Establishes non-blocking connections to remote services and APIs to exchange data streams while keeping the primary application responsive.
- [Connection and Latency Optimizers](https://awesome-repositories.com/f/networking-communication/connection-and-latency-optimizers.md) — Prioritizes IPv6 addresses and caches domain name lookups to reduce latency and improve connection reliability. ([source](https://github.com/reactphp/socket/blob/3.x/CHANGELOG.md))
- [Connection Management](https://awesome-repositories.com/f/networking-communication/connection-management.md) — Facilitates non-blocking network connections to remote services and sockets, resolving via promises to handle data exchange operations without stalling. ([source](https://reactphp.org/))
- [Timeout Managements](https://awesome-repositories.com/f/networking-communication/connection-management/websocket-connection-managers/timeout-managements.md) — Automatically aborts unresponsive connection attempts to prevent hanging processes and maintain system responsiveness. ([source](https://github.com/reactphp/socket#readme))
- [Connection Rate Limiting](https://awesome-repositories.com/f/networking-communication/connection-rate-limiting.md) — Enforces limits on the number of simultaneous client connections to protect system resources from exhaustion. ([source](https://github.com/reactphp/socket#readme))
- [Network Data Streaming](https://awesome-repositories.com/f/networking-communication/network-data-streaming.md) — Processes incoming and outgoing data chunks incrementally through event-based interfaces to maintain high throughput and low memory usage. ([source](https://reactphp.org/))
- [Secure Socket Wrappers](https://awesome-repositories.com/f/networking-communication/socket-networking/secure-socket-wrappers.md) — Applies transport layer security by wrapping standard network streams in cryptographic layers during the connection handshake process.
- [Duplex Stream Wrappers](https://awesome-repositories.com/f/networking-communication/streaming-apis/duplex-stream-wrappers.md) — Exposes network connections as readable and writable streams to process data chunks incrementally with low memory overhead.
- [Unix Domain Socket Support](https://awesome-repositories.com/f/networking-communication/unix-domain-socket-support.md) — Facilitates efficient inter-process communication on the same machine by connecting to or hosting services via local filesystem socket paths.

### Software Engineering & Architecture

- [Non-Blocking Event Loops](https://awesome-repositories.com/f/software-engineering-architecture/non-blocking-event-loops.md) — Uses a single-threaded event loop to manage multiple concurrent network connections without blocking the main execution process.

### Data & Databases

- [Event-Based Stream Processing](https://awesome-repositories.com/f/data-databases/event-based-stream-processing.md) — Manages high-throughput data exchange by processing incoming and outgoing network chunks incrementally through non-blocking, event-based interfaces.

### Operating Systems & Systems Programming

- [File Descriptor Managers](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management-systems/native-resource-lifecycle-managers/file-descriptor-managers.md) — Interacts with the operating system by listening on raw file descriptors to enable integration with external process managers.

### Programming Languages & Runtimes

- [Promise-Based Object Resolution](https://awesome-repositories.com/f/programming-languages-runtimes/promise-based-object-resolution.md) — Handles network operations and hostname lookups by returning objects that represent eventual completion of non-blocking tasks.
