PHP Foundation Modernizes Streams Subsystem with Async, TLS, and Error Handling Upgrades
The PHP Foundation has announced a comprehensive modernization of PHP’s Streams subsystem, with funding support from the Sovereign Tech Agency (STA), a German government-backed organization that invests in open-source infrastructure. In a blog post authored by Jakub Zelenka, the Foundation outlined major updates aimed at enhancing performance, security, error handling, and asynchronous capabilities.
First introduced in 2001, Streams provide a unified API for handling I/O across files, sockets, and memory. While powerful, the subsystem has lagged behind in meeting modern requirements. The Foundation's new initiative will eliminate reliance on mmap, introduce a high-performance copying API, and implement modern I/O approaches like io_uring for Linux.
Filtering and seeking improvements are also underway. A new seeking API will improve consistency across stream types, especially in complex data workflows. Error handling is being standardized with richer debugging data and improved propagation of I/O issues to user space.
Networking enhancements include a revamped polling system supporting epoll and kqueue, solving scaling issues in stream_select. The new polling API will allow more efficient async event handling, with added support for socket contexts and file descriptor utilities.
Security upgrades target the OpenSSL extension with improved async TLS handling and full support for TLS 1.3 features such as PSK, early data (0-RTT), and cipher suite selection. A custom TLS 1.3 testing library is being built to simulate protocol flows and edge cases during development.
- New copying and seeking APIs replace outdated mechanisms like
mmap - Async I/O support via
io_uring,epoll, andkqueue - Better error reporting and internal hooks for non-blocking I/O
- Refactored OpenSSL for improved TLS 1.3, PSK, and 0-RTT support
- Modernized socket and polling infrastructure for high-performance applications
Development began in 2025 and will continue through 2026, with updates shared via PHP internals and Foundation channels. Technical deep dives and benchmarks will follow as implementation milestones are reached.
