qmetrics.net

Swoole Src

PHP coroutine extension for concurrent network services

Swoole Src screenshot

Swoole is a PHP extension that provides an event loop, coroutines, and protocol servers. It targets HTTP APIs, WebSockets, and long-lived TCP or UDP services.

Overview

Swoole combines a C and C++ core with a PHP library to run persistent network programs and concurrent I/O in PHP. The reactor watches sockets and dispatches events while worker processes can scale across CPU cores; coroutines let other work proceed while one task waits on supported I/O.

Server APIs cover generic TCP, UDP, and Unix sockets, dedicated HTTP and WebSocket servers, and coroutine-managed HTTP serving. Clients include coroutine TCP, UDP, HTTP, and lower-level socket APIs, plus optional hooks that make some blocking PHP functions yield inside coroutines.

HTTP support spans request and response handling, uploads, streaming output, HTTP/2, and WebSocket framing. Connection pools in the PHP layer help reuse database and Redis connections; process tools such as Task workers, Timer, Table shared memory, and atomics coordinate background work and cross-process state.

Install through PECL or by compiling the extension, then load it in php.ini. Typical first steps run an HTTP server script that stays alive until stopped. Optional build flags add TLS, curl, PostgreSQL, DNS via c-ares, io_uring on Linux, and thread support with a ZTS PHP build.

Key features

  • Event-driven server and client APIs
  • PHP coroutines with Channel coordination
  • HTTP, HTTP/2, and WebSocket servers
  • Coroutine HTTP and TCP clients
  • Runtime hooks for blocking PHP calls
  • Task workers and shared memory Table
  • Connection pools for databases and Redis
  • Multi-worker and timer scheduling

Use cases

  • Long-running PHP HTTP microservices
  • WebSocket chat or realtime backends
  • High-connection-count TCP gateways
  • Concurrent upstream HTTP or RPC calls

Tags

Similar software

FastAPI

Python web framework for building APIs with type hints

FastAPI is a Python web framework for building APIs using standard type hints. It builds on Starlette and Pydantic and generates interactive OpenAPI documentation for the endpoints you define.

★ 105.1k⟳ 9 days agoMIT

NestJS

Progressive TypeScript framework for Node.js backends

Nest organizes Node server apps with modules, dependency injection, and first-party packages for auth, data, queues, and observability.

★ 77.2k⟳ todayMIT

OkHttp

HTTP client for JVM, Android, and GraalVM

OkHttp is an HTTP client library tuned for efficient networking on Android, Java, and GraalVM native images. It offers synchronous and asynchronous call APIs with a fluent request builder.

★ 47.1k⟳ yesterdayApache-2.0
Frameworks & PlatformsDesktop/CLI app

gRPC

Cross-language remote procedure call framework

gRPC is an RPC framework that lets client and server programs communicate transparently and supports building connected, multi-language systems.

★ 45.5k⟳ todayApache-2.0

tRPC

End-to-end typesafe TypeScript APIs without code generation

tRPC helps teams define server procedures and call them from clients with full TypeScript types for inputs, outputs, and errors—no schemas or codegen step.

★ 40.9k⟳ todayMIT
Frameworks & PlatformsDesktop/CLI app

go-zero

Cloud-native Go microservices and RPC framework

go-zero is a Go web and RPC framework with code generation, built-in resilience middleware, and tooling aimed at stable high-traffic services.

★ 33.5k⟳ 9 days agoMIT