Why ZealPHP?
PHP powers 77% of the web. Its execution model is what needs upgrading.
ZealPHP brings coroutine-native, real-time server architecture to PHP.
The problem
PHP's traditional request-per-process model (PHP-FPM, mod_php) is fundamentally incompatible with real-time, high-concurrency, and streaming use cases. Every request starts from scratch — no shared state, no persistent connections, no coroutines. Building a WebSocket server, streaming AI responses, or running background tasks requires leaving PHP entirely for Node.js, Go, or Python.
Existing async PHP solutions are either too low-level (raw Swoole, ReactPHP, AMPHP), framework-locked (Laravel Octane), or not native PHP (FrankenPHP, RoadRunner). None provide a full-stack, coroutine-native framework with a migration path for existing PHP apps.
ZealPHP's approach
Coroutine-native, not event-loop
Write synchronous-looking code. Under the hood, every I/O call (file, curl, PDO, sleep) yields the event loop via OpenSwoole's coroutine hooks. Thousands of concurrent requests per worker, zero callback hell.
Full-stack framework, not a library
Routing, PSR-15 middleware, templating with streaming, WebSocket, SSE, shared memory,
task workers, sessions — all integrated. Write $app->route() and ship.
Not 12 packages wired together.
Legacy PHP bridge — LAMP-style file routing
Drop .php files in public/ and they route automatically — just like Apache.
session_start(), header(), $_GET, echo
all work unchanged via uopz. Drop files in api/ and they become REST endpoints.
Many existing PHP apps — including WordPress sites — run unchanged through the CGI worker bridge. Migrate at your own pace — file by file, feature by feature.
Single-process deployment
HTTP server, WebSocket server, task workers, timers, shared memory, sessions —
all in one php app.php. No Nginx, no Redis, no Supervisor, no cron.
Deploy a systemd service and you're done.
Competitive landscape
Every project below serves a different need. This comparison is about where ZealPHP fits — not about which is "best."
| Project | Model | Routing | WebSocket | Streaming | Shared Memory | Legacy PHP |
|---|---|---|---|---|---|---|
| ZealPHP | Coroutine | Built-in | Built-in | yield / SSE / stream() | Store + Counter | CGI worker |
| ReactPHP | Event loop | Manual | Via packages | Manual | No | No |
| AMPHP | Fiber | Manual | Via packages | Manual | No | No |
| FrankenPHP | Go worker | Via framework | Via framework | Via framework | No | Partial |
| RoadRunner | Go worker | Via framework | Go plugin | Via framework | No | No |
| Laravel Octane | Swoole/RR | Laravel | Via packages | Limited | Limited | No |
| Raw Swoole | Coroutine | Manual | Manual | Manual | Table / Atomic | No |
ZealPHP vs Laravel Octane
Two different problems:
- Laravel Octane accelerates an existing Laravel application by serving it from a long-running Swoole / RoadRunner / FrankenPHP worker. If you're on Laravel and want it faster, use Octane.
- ZealPHP is a framework-agnostic layer over OpenSwoole. Routing, middleware, WebSocket, SSE, shared memory, timers, and the legacy PHP bridge are exposed as first-class primitives — no Laravel kernel in between.
If you have a Laravel app, Octane is the right tool. If you're starting fresh, migrating non-Laravel PHP, or need lower-level coroutine primitives, ZealPHP is built for that.
The migration ladder
You don't have to learn a framework to start. Drop files in a folder. Upgrade when you need to.
setFallback() — your entire existing app runs unchanged on OpenSwoole
public/*.php — LAMP-style file routing. $_GET, session_start(), echo just work
api/*.php — drop a file, get a REST endpoint. ZealAPI auto-routes by filename
$app->route() — WebSocket, SSE, streaming when you're ready
superglobals(false) — full coroutine mode, thousands of concurrent requests
When to use ZealPHP
Good fit
- AI/LLM apps with streaming responses
- Real-time dashboards and live updates
- WebSocket apps (chat, collaboration)
- High-concurrency APIs (10k+ req/s)
- Migrating large PHP codebases to async
- LAMP-style PHP devs who want async without learning a framework
- Single-process deployments (no infra complexity)
Not the right fit
- Already invested in Laravel ecosystem
- Need shared hosting (requires CLI access)
- Building a custom protocol server
- Want Fiber-based async (no ext dependency)
Benchmarks
Numbers below are from one benchmark setup on a single machine. Real-world performance depends on payload size, I/O, OS limits, and tuning. Reproduce them yourself before you trust them.
ab -n 50000 -c 200 -k
|
PERF.md
|
reproduce locally
Don't trust our numbers — run it yourself:
scripts/bench_vs_express.sh