IPERAMUNA.COM
Article March 20, 2024

FrankenPHP: The Future of High-Performance PHP Applications

Discover how FrankenPHP is revolutionizing PHP performance by combining Caddy, Go, and native worker mode. Learn when to use it and how it compares to traditional PHP-FPM.

If you've been deploying PHP applications for the last decade, you're likely intimately familiar with the Nginx + PHP-FPM stack. It's battle-tested, reliable, and... starting to show its age.

Enter FrankenPHP.

Built on top of the modern Caddy web server and written in Go, FrankenPHP isn't just another server—it's a rethinking of how PHP applications should run.

Why Should You Care?

Traditional PHP execution is "shared-nothing." Every single HTTP request starts a fresh process, boots up the framework, handles the request, and then dies. This checks all the boxes for stability but leaves a lot of performance on the table.

FrankenPHP changes the game in two ways:

1. Classic Mode (The Easy Win)

In this mode, FrankenPHP acts as a drop-in replacement for PHP-FPM. You don't need to change a single line of code in your application.

  • Simple Config: Caddy's configuration is famously simple compared to Nginx.
  • Modern Features: You get HTTP/3 (QUIC), automatic HTTPS, and 103 Early Hints out of the box.
  • Performance: Even without worker mode, the Go-based architecture often outperforms standard FPM setups.

2. Worker Mode (The Speed Demon)

This is where things get exciting. By integrating with tools like Laravel Octane, FrankenPHP can boot your application once and keep it in memory.

  • Zero Boot Overhead: The framework doesn't restart for every request.
  • Persistent Connections: Database and Redis connections stay open.
  • Massive Throughput: We're talking 2x to 10x performance gains for heavy applications.

Getting Started

Installing FrankenPHP is surprisingly simple. You can download a single binary that contains everything you need—no external dependencies required.