What is FrankenPHP?
FrankenPHP is a modern PHP application server written in Go, designed to simplify PHP deployment and enhance performance. It embeds the official PHP executor within the state-of-the-art Caddy web server, providing native support for HTTP/1.1, HTTP/2, and HTTP/3 protocols. The tool automates HTTPS certificate generation and renewal through Let's Encrypt or ZeroSSL, requiring minimal configuration—users simply copy PHP files to the document root. It supports popular PHP extensions like OPcache and XDebug, and offers features such as worker mode, which keeps applications in memory for faster request handling, and early hints to improve website load times.
FrankenPHP enables building standalone, self-executable binaries for PHP web applications and command-line tools, eliminating dependencies. It includes built-in support for modern compression formats (Brotli, Zstandard, Gzip), structured logging, Prometheus metrics, tracing, and a Mercure hub for real-time event streaming. The server is extensible, compatible with PHP 8.2+, and designed for cloud-native deployment via Docker or Kubernetes, with graceful reloads for zero-downtime updates. It is natively supported by frameworks like Symfony and Laravel, and benchmarks show it can be up to 3.5x faster than PHP-FPM for certain applications.
Features
- Native Protocol Support: Provides HTTP/1.1, HTTP/2, and HTTP/3 compatibility out-of-the-box.
- Automatic HTTPS: Generates and renews SSL certificates using Let's Encrypt or ZeroSSL automatically.
- Worker Mode: Boots applications once and keeps them in memory for faster request processing.
- Standalone Binaries: Enables creation of self-executable, dependency-free binaries for PHP apps.
- Modern Compression: Supports Brotli, Zstandard, and Gzip compression formats for optimized performance.
- Real-time Capabilities: Includes a built-in Mercure hub for sending events to browsers instantly.
- Cloud-Native Deployment: Ships as a Docker image compatible with Kubernetes and modern cloud platforms.
- Early Hints Support: Improves website load times by up to 30% with early hints functionality.
- Structured Logging and Metrics: Offers structured logging and built-in Prometheus support for monitoring.
- Graceful Reload: Allows zero-downtime deployments through graceful reloads.
Use Cases
- Deploying PHP web applications with minimal configuration and automatic HTTPS.
- Building standalone, portable PHP binaries for command-line tools or web apps.
- Improving performance of API-driven applications using worker mode and HTTP/3.
- Streaming real-time updates to browsers via the built-in Mercure hub.
- Monitoring PHP applications with structured logging and Prometheus metrics.
- Serving static assets and PHP files efficiently with modern compression.
- Running PHP apps in cloud environments using Docker or Kubernetes.
- Developing with popular PHP frameworks like Symfony, Laravel, or API Platform.