book cover front cover for API Development with Laravel by Akintoye Adegoke

πŸš€ It’s here!
After months of writing and testing real-world code examples, I’m excited to announce my new book β€” API Development with Laravel: A Quick Start Guide πŸŽ‰
This project-based book introduces you to Laravel, even if you’re completely new to it β€” and shows you how to build a real Payment Processor API step by step.

FrankenPHP

In this post, we'll be looking at FrankenPHP. A modern, high-performance PHP application server and runtime designed to serve PHP applications without relying on traditional web servers like Apache or Nginx. It aims to simplify PHP deployment while improving performance, especially for modern apps like those using Laravel or Symfony.


πŸ”§ What is FrankenPHP?

FrankenPHP is:

  • A PHP web server: It can run your PHP code directly.

  • Built with Caddy: A popular Go-based web server known for its simplicity and automatic HTTPS support.

  • Embedded PHP: It embeds the PHP engine in the web server itself, eliminating the need for php-fpm.

  • Async / Worker-Friendly: It supports long-running worker processes (like Laravel Octane), WebSockets, HTTP/2, and Server-Sent Events out of the box.


πŸ’‘ Why Use FrankenPHP?

Traditional StackFrankenPHP
Nginx/Apache + PHP-FPMJust FrankenPHP (no FPM needed)
Separate server configEverything in one place
Manual HTTPS setupAutomatic HTTPS via Caddy
Slow cold starts (FPM)Persistent workers = faster apps
Harder async/WebSocket setupNative support

πŸ› οΈ Use Cases

  • Laravel, Symfony, or WordPress hosting

  • Server-Sent Events (SSE) or WebSockets

  • Microservices or APIs

  • Running PHP without setting up Nginx or Apache

  • Building Docker images for PHP easily


πŸš€ Key Features

  • βœ… Native HTTP server (via Caddy)

  • βœ… Runs PHP scripts directly

  • βœ… Async features (e.g., SSE, WebSockets)

  • βœ… Better performance (persistent workers)

  • βœ… Compatible with PHP frameworks

  • βœ… Docker-ready

  • βœ… Automatic HTTPS with Let's Encrypt


πŸ” How It Works (Simply)

  • Caddy handles HTTP requests.

  • PHP is embedded directly in Caddy.

  • Your PHP code runs immediately, without needing to be passed through FPM or another proxy.

  • FrankenPHP manages lifecycle, workers, and memory, letting you keep services running across requests if needed.


🐳 Example Docker Usage

Β 
FROM dunglas/frankenphp COPY . /app WORKDIR /app # Serve your Laravel/Symfony app CMD ["frankenphp", "--config", "/app/Caddyfile"]

πŸ“š Getting Started


πŸ”„ FrankenPHP vs Laravel Octane?

  • Octane requires Swoole or RoadRunner.

  • FrankenPHP works out-of-the-box, no PHP extensions or extra tools.

  • Both enable persistent workers and speed improvements.

Comments