fujiale33/swoole-src
38.9
Weak · 5 August 2026
8.4k
lines of production code
PHP
primary language
5
measurements over time
What this system is
This system is a high-performance, asynchronous event-driven networking framework for PHP, implemented as a C extension. It provides a comprehensive suite of tools for building scalable network applications, including HTTP/2, WebSocket, and TCP/UDP servers and clients. The codebase also includes extensive support for coroutines, process management, and inter-process communication, alongside robust testing and benchmarking infrastructure.
How it got here
2012–2014 — Core C-level infrastructure and stability
21 changes.
This period focused on building the foundational C-level infrastructure for Swoole, introducing new modules for memory management, networking, process handling, and protocol parsing. Concurrently, the codebase underwent significant stability improvements, addressing core dumps, memory leaks, and compilation errors across the extension.
2015–2016 — comprehensive example expansion
20 changes.
This period focused on significantly expanding the project's documentation and testing infrastructure by adding a wide array of example scripts. These new files covered diverse networking protocols, database integrations, and concurrency patterns, providing practical references for developers. Additionally, benchmarking tools were introduced to evaluate performance across various protocols and use cases.
2017 — comprehensive test suite expansion
25 changes.
This period focused on establishing a robust automated testing infrastructure for the Swoole project. The work involved adding extensive unit tests for core components, including HTTP/2, MySQL, Redis, and WebSocket servers, alongside utility scripts to automate test execution across different PHP versions.
2018 — Coroutine support and examples
5 changes.
This period focused on expanding coroutine capabilities for Redis and PostgreSQL, including new test coverage and example scripts. The work emphasized demonstrating non-blocking database operations and channel selection mechanisms through practical implementations.
Features
Add EOF protocol examples for Swoole clients and server
Added example scripts for the EOF (End of File) protocol in the examples/eof directory. The server.php demonstrates how to configure the Swoole server with open\_eof\_check, package\_eof, and open\_eof\_split settings. The client.php and async\_client.php show how to connect and send data using synchronous and asynchronous Swoole clients, respectively, with EOF delimiters.
examples/eof · high confidence
Add HTTP/2 client and server examples
Added new example scripts for HTTP/2 communication. The client example demonstrates how to connect to an HTTP/2 server using SSL, set headers, and handle responses. The server example shows how to configure a Swoole HTTP/2 server with SSL certificates and enable the HTTP/2 protocol.
examples/http2 · high confidence
Add MySQL example scripts for prepared statements, transactions, and async operations
Added new example files in the mysql examples directory to demonstrate various MySQL usage patterns. This includes prepared statement examples for both the MySQLi and PDO extensions (mysqli\_prepare.php, pdo\_prepare.php, pdo\_prepare2.php, prepare.php), a transaction example using the Swoole MySQL client (transaction.php), and an asynchronous MySQL query example (real\_async.php). Additionally, a synchronous MySQLi example (sync.php) was added. These files provide reference implementations for connecting to MySQL, executing parameterized queries to prevent SQL injection, managing transactions, and performing non-blocking queries.
examples/mysql · high confidence
Add PHP examples for Swoole atomic operations
New PHP example scripts demonstrate the usage of the Swoole atomic classes. long.php shows the Swoole\\Atomic\\Long class with methods like get, add, sub, and cmpset. test.php demonstrates the swoole\_atomic class with add, sub, cmpset, and get methods. wait.php illustrates the wait and wakeup methods for process synchronization.
examples/atomic · high confidence
Add PHP network and debugging example scripts
Added new PHP example scripts for network communication and debugging: a UDP-based debug server (debug\_server.php) that logs memory allocation/free events, an inotify watcher (inotify.php) for file change detection, a MySQLi async query example (mysql.php), and various TCP/UDP client and server implementations (socket\_client.php, socket\_server.php, stream\_client.php, stream\_server.php) demonstrating socket and stream-based connections.
examples/php · high confidence
Add PostgreSQL coroutine example demonstrating metadata retrieval
A new example file, examples/postgresql/postgresql\_coro.php, has been added to demonstrate the use of the Swoole PostgreSQL coroutine extension. The example showcases connecting to a PostgreSQL database, executing a query, and specifically illustrates the use of the new metaData method to retrieve table metadata, alongside standard query execution.
examples/postgresql · high confidence
Add SSL support for Swoole client
Added example files in the examples/ssl directory to demonstrate SSL/TLS functionality for the Swoole client and server. This includes PHP and C implementations for secure connections, HTTP and WebSocket over SSL, and certificate/passphrase handling, enabling users to see how to configure SSL contexts, load certificates, and manage secure communication.
examples/ssl · high confidence
Add WebSocket client and server examples
Added new example files for WebSocket communication: a PHP-based WebSocket client (WebSocketClient.php) that handles connection, message parsing, and frame encoding/decoding, along with a corresponding server example (server.php) that implements a custom handshake and message handling. Also included are an async client example (async\_client.php), a benchmarking client script (client.php), and a simple HTML/JS client (client.html) for testing the WebSocket server.
examples/udp, examples/websocket · high confidence
Add client example scripts for various connection modes
Added example scripts for the Swoole client, including async, sync, long TCP, UDP (sync/async), and select-based client implementations, along with a test file for data transmission.
examples/client · high confidence
Add coroutine channel select examples
The examples/coroutine/select directory now includes four PHP scripts (1.php through 4.php) that demonstrate the usage of the chan::select function. These examples cover various scenarios including reading from multiple channels, handling timeouts, and managing write operations, providing practical illustrations of the coroutine channel selection mechanism.
examples/coroutine/select · high confidence
Add examples for SWOOLE\_MUTEX and UDP multicast communication
New example scripts are added to demonstrate concurrency primitives and network communication patterns. The lock example shows how to use SWOOLE\_MUTEX for process synchronization, while the multicast directory provides client and server scripts illustrating UDP-based multicast communication using the Swoole framework.
examples/multicast · high confidence
Add mmap example demonstrating shared memory mapping
A new PHP example at examples/mmap/mmap.php was added to demonstrate the use of the swoole\\mmap module for memory-mapped file operations, including creating a temporary file, opening it with mmap, writing data, and flushing the changes.
examples/mmap · high confidence
Add timer examples for recurring ticks and one-shot after timers
New example scripts demonstrate the usage of the timer API: \after.php\ shows how to schedule one-shot timers and clear them, \clear.php\ illustrates clearing timers, and \tick.php\ provides examples of recurring tick timers. These files serve as practical references for using \swoole\_timer\_after\, \swoole\_timer\_tick\, and \swoole\_timer\_clear\.
examples/timer · high confidence
Added HTTP client and server examples
Added new example files in the examples/http directory, including async and synchronous HTTP clients, an HTTP server, and scripts for file uploads, downloads, and proxy usage.
examples/http · high confidence
Added IPv6 example scripts for TCP and UDP clients and servers
New example scripts were added to the ipv6 directory, providing reference implementations for IPv6 networking. This includes a TCP client and server, as well as a UDP client and server, demonstrating how to establish connections, send and receive data, and handle basic events like connect, receive, and close in an IPv6 context.
examples/ipv6 · high confidence
Added Redis coroutine examples
Added two new PHP example scripts in the coroutine/redis directory: eval.php demonstrates using the Redis EVAL command within a coroutine, and request.php shows how to send a raw request using the Co\\Redis class. These examples illustrate how to perform Redis operations in a non-blocking, coroutine-based manner.
examples/coroutine/redis · high confidence
Added Redis example scripts for client, server, and pub/sub
Added example scripts demonstrating the new Swoole Redis capabilities: client.php shows basic get/set operations, server.php implements a simple Redis-like server with GET, SET, sAdd, sMembers, hSet, and hGetAll handlers, and subscribe.php demonstrates pub/sub message handling.
examples/redis · high confidence
Added SSL certificate, CSR, and key files for the ssl\_passwd example
The ssl\_passwd example now includes the necessary SSL components: a certificate (ssl.crt), a certificate signing request (ssl.csr), and an encrypted RSA private key (ssl.key). These files are required to run the example, which previously lacked the actual SSL artifacts needed for demonstration.
_examples/ssl/ssl\passwd · high confidence
Added Travis CI compilation script
A new shell script, travis/compile.sh, was added to the repository. This script automates the PHP extension compilation process by executing phpize, configuring the build environment, and running make to produce the compiled module.
travis · high confidence
Added Unix socket example scripts for Swoole
The repository now includes new example scripts in the examples/unixsock directory demonstrating how to use Unix domain sockets with Swoole. This includes asynchronous and synchronous client implementations (async\_client.php, stream\_client.php, dgram\_client.php) and corresponding server examples (stream\_server.php, dgram\_server.php) that showcase connection handling, message sending/receiving, and event listeners for connect, receive, error, and close states.
examples/unixsock · high confidence
Added comprehensive benchmark scripts for performance testing
A suite of new benchmark scripts has been added to the \benchmark/\ directory to evaluate the performance of the Swoole framework across various protocols and use cases. This includes HTTP servers (PHP, Go, Node.js), TCP/UDP echo servers, WebSocket handlers, coroutine-based database access (MySQL/Redis), and specific tests for timers, table operations, and serialization. These scripts allow users to measure throughput, latency, and resource usage for different network protocols and server configurations.
benchmark · high confidence
Added core data structures and utilities
Added new core data structures including a thread-safe ring queue, a channel for inter-process communication, a dynamic array, a hash map, a min/max heap, a doubly linked list, a red-black tree, and string utilities. These provide foundational building blocks for memory management, data storage, and system-level operations within the Swoole core.
src/core · high confidence
Added kqueue IDE helper header
A new header file, include/helper/kqueue.h, was added to provide IDE support for the kqueue API. This file defines the kevent struct and associated constants and function prototypes, enabling better code completion and navigation in IDEs for Linux environments.
include/helper · high confidence
Added leader-follower concurrency example
Added a new example script, examples/channel/leader\_follower.php, which demonstrates a leader-follower pattern using Swoole processes and channels. The script spawns four worker processes that pop tasks from a shared channel, while a timer periodically pushes tasks into the channel, illustrating inter-process communication and task distribution.
examples/channel · high confidence
Added length-checking protocol examples for Swoole
Added new PHP examples in the examples/length directory that demonstrate how to implement a length-based packet protocol using Swoole. The server-side (server.php, func.php) and client-side (client.php, async\_client.php) scripts configure the 'open\_length\_check' option to parse binary headers containing packet lengths, allowing the framework to automatically split and assemble complete messages based on the defined length fields.
examples/length · high confidence
Added namespace-based Swoole examples
Added new example files (http\_server.php, server.php, timer.php, atomic.php) and a README demonstrating Swoole's namespace-style API usage, including HTTP server setup, TCP server receive/send, timer ticks, and atomic operations.
examples/namespace · high confidence
Added new PHP utility scripts for development and testing
Four new PHP scripts have been added to the tools directory to support development workflows: check-package.php scans the tests directory and outputs an XML list of unit test files; export.php uses PHP's ReflectionClass to export class information; gen-data.php creates a temporary file with specific binary content for testing purposes; and ip.php queries a free IP geolocation API to return location data for a given IP address.
tools · high confidence
Added new example scripts for Swoole features
Added a collection of example scripts in the examples directory to demonstrate various Swoole capabilities. This includes buffer management (buffer.php, test\_buffer.php), connection handling (c10k.php, client2.php), channel and ring queue usage (channel.php, ringqueue.php), database connection pooling for MySQL and Redis (db\_pool.php, redis\_pool.php), proxy and async client implementations (proxy\_sync.php, mysql\_proxy\_server.php, swoole\_http\_client.php), file transfer (recv\_file.php, sendfile\_server.php), serialization (serialize.php, serialize2.php), and C/C++ server implementations (server.c, test\_server.c). These examples cover TCP/UDP servers, HTTP servers, and background process management.
examples · high confidence
Added new task processing examples
The examples/task directory now includes several new PHP scripts demonstrating Swoole task handling: http.php for HTTP-based task dispatching, msg\_push.php for message queue-based task pushing, shared\_client.php and shared\_server.php for client-server task interactions, task.php for basic async and sync task execution, task\_coro.php for coroutine-based multi-task waiting, task\_num.php for distributed task processing, task\_queue.php for task queue management, and task\_stream.php for stream-based task operations.
examples/task · high confidence
Added third-party HTTP and multipart parsers
The project now includes several new third-party libraries to handle HTTP and multipart data: a C-based HTTP parser (php\_http\_parser), a multipart/form-data parser (multipart\_parser), and submodules for nghttp2, picohttpparser, hiredis, and jemalloc. These additions provide the underlying parsing capabilities for HTTP requests and file uploads.
thirdparty · high confidence
Adds async I/O and DNS lookup examples
New example scripts demonstrate the use of the Swoole async API for DNS lookups, file reading, file writing, and process execution. The dns\_lookup.php script shows how to configure and perform asynchronous DNS resolution, while exec.php illustrates running external commands asynchronously. The read.php and readfile.php files provide templates for non-blocking file reads, and write.php and writefile.php show how to perform asynchronous file writes, including append mode.
examples/async · high confidence
Expanded coroutine examples for HTTP, MySQL, Redis, and more
The \examples/coroutine\ directory has been significantly expanded with numerous new example scripts demonstrating coroutine capabilities. This includes HTTP server and client implementations (\http\_server.php\, \http\_client.php\, \http2\_client.php\), MySQL connection and query examples (\mysql\_query.php\, \mysql\_prepare.php\), Redis interaction examples (\redis\_pool.php\, \redis\_subscribe.php\), and other coroutine features like \chan::select\, \co::fgets\, \co::fread\, \co::fwrite\, \co::gethostbyname\, and \taskCo\. These files serve as practical demonstrations of using coroutines for concurrent network operations.
examples/coroutine · high confidence
Expanded process management examples
Added new example scripts in the process directory, including alarm handling, asynchronous master-worker communication, process execution, function timeouts, message queues, and process selection. These examples demonstrate the usage of the Swoole process API for background tasks, inter-process communication, and signal handling.
examples/process · high confidence
Introduce process and thread-based factory implementations
The \src/factory\ directory now contains dedicated factory implementations for process-based (\FactoryProcess.c\) and thread-based (\FactoryThread.c\) execution models, alongside a base \Factory.c\. These files implement the core dispatch, finish, and shutdown logic for the server, enabling the server to operate in either multi-process or multi-threaded modes, which fundamentally changes how the server manages worker tasks and connections.
src/factory · high confidence
Introduces new OS abstraction layer for async I/O, signals, and timers
Adds a new \src/os\ directory containing implementations for asynchronous file I/O (including Linux AIO and base thread-pool fallbacks), message queues, signal handling (with \signalfd\ support), system timers (using \timerfd\ or \setitimer\), and \sendfile\ operations. This refactors and consolidates the underlying OS-specific logic for these capabilities, providing a unified interface for the rest of the application.
src/os · high confidence
New event loop and I/O examples
Added new example scripts in the examples/event directory to demonstrate Swoole's event handling capabilities. The new files include cycle.php for the event loop, inotify.php for file system monitoring, sockets.php for TCP socket I/O, stdin.php for standard input, stream.php for stream-based I/O, and test.php for basic event testing.
examples/event · high confidence
New examples for the swoole\_table API
Added five new PHP scripts in the examples/table directory that demonstrate how to use the swoole\_table class. The examples cover basic array-style access (array.php), iterator-based traversal and deletion (iterator.php), integration with a swoole\_server for connection tracking (server.php), performance benchmarking of set/get operations (set.php), and a simulation script to verify table usability under random operations (simulation.php).
examples/table · high confidence
New internal header files for core data structures
Added new header files in the include directory to define internal data structures and utilities for the Swoole framework. These include Client.h for client connection and proxy state management, Connection.h for SSL and socket operations, Server.h for server event types and worker configurations, RingQueue.h for thread-safe queue operations, and utility headers for arrays, async I/O, atomic operations, base64 encoding, buffers, coroutines, error codes, and hash functions. These headers provide the foundational C-level interfaces and structures used by the Swoole extension.
include · high confidence
New lock implementations for synchronization
The \src/lock\ directory now includes new C source files implementing various locking mechanisms: atomic locks, condition variables, file locks, mutexes, read-write locks, semaphores, and spinlocks. These provide the underlying synchronization primitives for the Swoole framework, enabling features like thread-safe data structures and process-shared locking.
src/lock · high confidence
New memory management subsystem with multiple allocator backends
The \src/memory\ directory now contains a new memory management subsystem, introducing dedicated source files for different allocation strategies: a generic buffer (\Buffer.c\), a fixed-size object pool (\FixedPool.c\), a global page-based allocator (\MemoryGlobal.c\), a ring buffer (\RingBuffer.c\), shared memory wrappers (\ShareMemory.c\), and a hash-table-based memory table (\Table.c\). This adds new capabilities for managing memory pools, shared memory, and in-memory data structures within the Swoole framework.
src/memory · high confidence
New network module implementation for client, connection, DNS, and process management
The src/network directory now contains the core C implementation for the Swoole network layer, introducing new files for client handling (Client.c), connection management (Connection.c), DNS resolution (DNS.c), port configuration (Port.c), process pool management (ProcessPool.c), and manager processes (Manager.c). These files establish the foundational behavior for TCP/UDP/Unix socket clients, asynchronous DNS lookups, and worker process lifecycle management, replacing previous or missing implementations in this location.
src/network · high confidence
New pipe backend implementations
The Swoole library now includes new pipe backend implementations: PipeBase (using standard POSIX pipes), PipeEventfd (using eventfd for high-performance signaling), and PipeUnsock (using Unix domain sockets). These new files introduce the underlying mechanisms for inter-process communication, supporting both blocking and non-blocking modes, and allowing configuration of socket buffer sizes.
src/pipe · high confidence
New protocol parsers and handlers for HTTP, HTTP/2, WebSocket, and more
The \src/protocol\ directory now includes new C source files that implement protocol parsers and handlers for HTTP, HTTP/2, WebSocket, Base64, Mqtt, Redis, SSL, SHA1, Socks5, and MimeTypes. This adds support for parsing and handling these specific network protocols within the Swoole framework.
src/protocol · high confidence
New server examples for dispatch, messaging, and protocols
Added a suite of new example scripts in the server examples directory to demonstrate advanced Swoole capabilities. These include custom dispatch functions and modes (IP and UID-based), asynchronous hot-reloading, inter-process messaging via pipes, and integration with external systems like ZeroMQ. The examples also cover handling fixed-header protocols, Unix domain sockets, and slow request tracing.
examples/server · high confidence
Refactored the reactor module with a unified interface and platform-specific backends
The reactor subsystem has been refactored to provide a unified C API for event loop management, supporting multiple underlying I/O mechanisms including epoll, kqueue, poll, and select. This change introduces new source files (ReactorBase.c, ReactorEpoll.c, ReactorKqueue.c, ReactorPoll.c, ReactorSelect.c) that implement a consistent interface for adding, removing, and waiting on file descriptors, allowing the application to benefit from the most efficient event notification method available on the current operating system.
src/reactor · high confidence
Behavioural changes
Fixes numerous stability and memory issues across the Swoole extension
This update addresses a large number of bugs, including core dumps, memory leaks, and compilation errors across the Swoole extension. Key fixes include resolving crashes in the HTTP/2 client, MySQL, and Redis clients; fixing memory leaks in the HTTP client and coroutine modules; and correcting various compile failures on macOS, Cygwin, and PHP 7. The changes also include general code optimizations, warning-free updates, and fixes for specific issues such as the \swoole\_server\ crash when using multi-listen ports and the \swoole\_http\_server\ crash when executing close in a callback function.
(repo-wide) · low confidence
Test coverage
Added Redis coroutine test cases; Added async client test suite; Added comprehensive test coverage for Swoole API components; Added extensive test coverage for Swoole server features; Added memory leak regression tests for Swoole clients and servers; Added test coverage for Swoole server port and TCP EOF handling; Added test for HTTP/2 client GET request; Added test for handling large Redis packets; Added test infrastructure and automation scripts; Added test infrastructure and unit tests for Swoole components; Added test utility classes and functions for Swoole testing; Added tests for Swoole Coroutine Redis defer and connection handling; Added tests for Swoole HTTP client and event loop; Added tests for Swoole HTTP server capabilities; Added tests for Swoole HTTPS client; Added tests for Swoole process management; Added tests for Swoole sync client and global functions; Added tests for the Swoole MySQL extension; Added unit tests for Swoole Redis connection and messaging; Added unit tests for Swoole WebSocket server scenarios; Added unit tests for Swoole async I/O functions; Added unit tests for swoole\_table; Added unit tests for swoole\_timer edge cases and functionality; Added unit tests for the swoole\_serialize extension; Expanded coroutine test suite for networking and database clients.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 39 → 39 (+0.0)
- Rubric changed (rubric-2026.08.18 → rubric-2026.08.19) — scores are not directly comparable.
Lenses
- Code Health 96 → 96 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 49 → 49 (+0.0)
- Readiness 33 → 33 (+0.0)
- Security 24 → 24 (+0.0)
Findings
- No change — the same findings as the prior survey.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
fujiale33/swoole-src was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 5 August 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 264c9b6aa42e43b704d79c2b3df2a71a45c4fb37 — the exact code this score is about.
- Scored under rubric-2026.08.19 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer latest.