FrankenPHP vs Swoole: Which Should You Run Laravel On?
Direct answer: FrankenPHP is a PHP app server built on Go and Caddy that runs PHP in threads, with automatic HTTPS, HTTP/3 and an easy path from classic mode to worker mode. Swoole is a C++ PHP extension that adds an event loop and coroutines, so one worker can wait on many I/O calls at once. For a typical Laravel app, FrankenPHP is the simpler choice. Pick Swoole when you need WebSockets, in-process concurrency or Octane's Swoole-only features.
At MarginTop we run Laravel Octane on Swoole in production and maintain our own Swoole + io_uring Docker image, so I'm not neutral here, and I'll say where FrankenPHP is the better call anyway. My five-way runtime comparison covers FPM and RoadRunner too. This post is just the head-to-head people keep searching for.
What FrankenPHP and Swoole actually are#
FrankenPHP is a web server, not an extension. Created by Kévin Dunglas, it embeds PHP inside Caddy, so one binary gives you the web server, TLS certificates, HTTP/2 and HTTP/3, early hints and a Mercure real-time hub. The PHP Foundation took it under its wing in May 2025, and it now lives at github.com/php/frankenphp.
Swoole is a PHP extension written in C and C++. It gives PHP its own event loop, an HTTP and WebSocket server, and coroutines: lightweight tasks that pause while they wait on a database or an HTTP call and let other tasks run. Swoole 6 added multithreading on top of its long-standing process model.
Both can run your app as long-lived workers that boot Laravel once and serve many requests, and both are supported Laravel Octane drivers.
FrankenPHP vs Swoole side by side#
| FrankenPHP | Swoole | |
|---|---|---|
| Type | App server (Go + Caddy) with PHP embedded | PHP extension (C/C++) |
| Concurrency model | PHP threads; one request per thread at a time | Event loop + coroutines; many in-flight I/O waits per worker |
| Modes | Classic (FPM-like) or worker mode | Always long-running |
| HTTPS, HTTP/3 | Built in, automatic certificates | Usually behind nginx or a load balancer |
| WebSockets / real-time | Via the built-in Mercure hub (server-sent events) | Native WebSocket server |
| Octane extras | Core Octane features | Plus Octane::concurrently(), Octane Cache, Swoole Tables, ticks |
| Extension compatibility | Needs thread-safe extensions; imap, newrelic and pcov are listed as unsupported | Code and clients must be coroutine-safe when hooks are on |
| Backing | PHP Foundation | Swoole team |
| Latest release (Nov 2026) | v1.13.5 (Nov 5) | v6.2.5 (Nov 7) |
The real difference: threads vs coroutines#
This one design choice explains almost everything else.
In FrankenPHP's worker mode, each PHP thread handles one request at a time. If a request waits 200 ms on an external API, that thread waits too. You get concurrency by having more threads (the default is twice your CPU count, and max_threads can scale up automatically).
In Swoole, a worker that's waiting on I/O yields, and the same worker picks up other work. Inside a single request you can fire three API calls at once:
[$user, $orders, $limits] = Octane::concurrently([
fn () => Http::get("$crm/users/$id")->json(),
fn () => Order::where('user_id', $id)->latest()->take(20)->get(),
fn () => Http::get("$billing/limits/$id")->json(),
]);
That call is Swoole-only in Octane. If your endpoints fan out to several slow services, or you hold thousands of WebSocket connections, Swoole's model is a real advantage. If your endpoints are "query the database, render JSON", the difference mostly disappears and FrankenPHP's simpler setup wins.
Operations: what you live with day to day#
FrankenPHP is easier to run. One binary or Docker image, automatic certificates, a Caddyfile instead of nginx plus FPM pools, and a file watcher for development. You can start in classic mode and turn on worker mode later.
Swoole asks more of you. You'll usually put nginx or a load balancer in front, tune worker counts, and make sure every library you use behaves inside coroutines. In return you get the most control over how PHP handles concurrency.
Two caveats from FrankenPHP's known-issues page are worth knowing before you migrate. Since PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, hitting the hard memory limit can stop the whole FrankenPHP server, not just one worker, so run it under a supervisor that restarts it. And ImageMagick's OpenMP threads conflict with FrankenPHP's, so disable Imagick threading if you process images.
Both projects ship security fixes often. FrankenPHP's v1.13.4 and v1.13.5 (October and November 2026) fixed 7 and 17 vulnerabilities respectively; Swoole's v6.2.5 included an upload-handling security fix. Whichever you choose, you now own patching a web server, not just PHP. That's the patch velocity argument in practice.
Which should you choose?#
- New Laravel app, normal CRUD and APIs: FrankenPHP with Octane. Fewer moving parts.
- Moving off nginx + PHP-FPM gradually: FrankenPHP in classic mode first. See FrankenPHP vs PHP-FPM.
- WebSockets, IoT devices, long-lived connections: Swoole.
- Endpoints that call several slow services: Swoole, for
Octane::concurrently(). - You depend on New Relic, imap or pcov in production: not FrankenPHP, for now.
- Small team, nobody wants to learn coroutine safety: FrankenPHP.
My own default is Swoole, even for a standard SaaS backend. Many of the systems we build talk to devices and hold connections open, but the bigger reason is that once a team has learned coroutine-safe habits, Swoole costs little extra and you never hit a ceiling. When a product later needs WebSockets, parallel API calls or in-memory tables, they're already there, with no runtime migration. FrankenPHP is the easier start if your team has never run long-lived PHP and wants the fewest moving parts.
Whatever you pick, the long-running rules are identical: no request data in static properties or singletons, recycle workers with a max-requests limit, and restart workers on every deploy.
Frequently asked questions#
Is FrankenPHP faster than Swoole?#
There is no universal winner; both remove per-request boot cost in worker mode. Swoole has the edge when requests wait on several slow I/O calls, because coroutines let one worker overlap them. Benchmark your own endpoints.
Does Laravel Octane support FrankenPHP?#
Yes. Octane supports FrankenPHP, Swoole and RoadRunner. Some Octane features, such as concurrent tasks, Octane Cache and Tables, require Swoole.
Can FrankenPHP do WebSockets?#
Not as a native WebSocket server. FrankenPHP ships a built-in Mercure hub for real-time updates over server-sent events. For native WebSockets, Swoole is the usual choice.
Which PHP extensions don't work with FrankenPHP?#
FrankenPHP's known-issues page lists imap, newrelic and pcov as unsupported because they are not thread-safe, and notes instability with datadog profiling and Imagick's OpenMP threading.
Key takeaways#
- FrankenPHP is a Go/Caddy app server running PHP in threads; Swoole is a C++ extension adding an event loop and coroutines.
- Threads vs coroutines is the core difference: Swoole can overlap I/O inside one worker and one request; FrankenPHP scales by adding threads.
- FrankenPHP wins on simplicity: built-in HTTPS and HTTP/3, classic mode as a stepping stone, PHP Foundation backing.
- Swoole wins for WebSockets, fan-out endpoints and Octane's Swoole-only features.
- Check extension compatibility (imap, newrelic, pcov, Imagick threading) before moving to FrankenPHP.
Sources#
- FrankenPHP docs: configuration and known issues
- FrankenPHP releases
- Swoole releases
- Laravel Octane documentation
Deciding on a runtime for a Laravel product? Get in touch.