DEV Community

Cover image for FrankenPHP: The Modern PHP App Server, written in Go
Aboozar Ghaffari
Aboozar Ghaffari

Posted on

FrankenPHP: The Modern PHP App Server, written in Go

FrankenPHP is a modern PHP application server built on the Caddy web server, offering developers a powerful alternative to traditional setups like PHP-FPM and Nginx. In this article, I'll explore how FrankenPHP improves performance, simplifies deployment, and enhances security with cutting-edge features like worker mode, real-time event support, and automatic HTTPS. Whether you're working with Laravel, Symfony, WordPress, or other PHP frameworks, discover why FrankenPHP is quickly becoming the go-to solution for developers seeking to optimize their production environments.

If you're a PHP developer looking to improve your application’s performance, security, and deployment process, it's time to consider switching to FrankenPHP as your production web server. Built on the robust Caddy web server, FrankenPHP brings modern innovations that traditional setups like PHP-FPM and Nginx can’t match.

With features like worker mode, which keeps your app in memory for faster performance, and real-time event capabilities that allow seamless communication between your app and the browser, FrankenPHP can significantly boost your app's responsiveness and user experience. It also supports automatic HTTPS, HTTP/2, and HTTP/3, ensuring your app is secure and uses the latest web protocols without any additional configuration.

FrankenPHP also simplifies your deployment by packaging your app as a standalone binary, eliminating the need for managing multiple processes like PHP-FPM and Nginx. Whether you work with Laravel, Symfony, WordPress, or any other PHP framework, FrankenPHP will make your app faster, more efficient, and easier to manage.

For developers looking to streamline their workflow and deliver better performance to end users, switching to FrankenPHP is a smart move. Start exploring today and elevate your PHP projects to the next level.

FrankenPHP at a glance:

  • Caddy Webserver: Uses the official PHP executor embedded in a state-of-the-art web server: Caddy
  • Extensible: Compatible with PHP 8.2+, most PHP extensions and all Caddy modules.
  • Only one service: Designed with simplicity in mind: only one service, only one binary! FrankenPHP doesn’t need PHP-FPM, it uses its own SAPI specially handcrafted for Go web servers.
  • Easy deploy: Cloud Native app shipped as a Docker image. Compatible with Kubernetes, and all modern cloud platforms. It’s also possible to package your PHP app as a standalone, self-executable static binary.
  • Worker mode: Boot your application once and keep it in memory! It is ready to handle incoming requests in a few milliseconds.
  • 103 Early Hints: Early Hints are a brand new feature of the web platform that can improve website load times by 30%. FrankenPHP is the only PHP SAPI with Early Hints support!
  • Real-time: Built-in Mercure hub. Send events from your PHP apps to all connected browsers, they instantly receive the payload as a JavaScript event!
  • Brotli, Zstandard and Gzip compression: Modern compression formats are supported out-of-the-box.
  • Structured logging: Bring a more defined format and details to your logging.
  • Prometheus metrics and tracing: Built-in Prometheus support!
  • HTTP/2 & HTTP/3: Native support for HTTPS, HTTP/2 and HTTP/3.
  • HTTPS Automation: Automatic HTTPS certificate generation, renewal and revocation.
  • Graceful reload: Deploy your apps with zero downtime thanks to graceful reloads.
  • Supports PHP extension: FrankenPHP supports the most popular PHP extensions, including OPcache and XDebug.

Modern Webserver For PHP

One command to run them all

# Docker
docker run -v $PWD:/app -p 443:443 dunglas/frankenphp

# Static binary
./frankenphp php-server

# Command-line script
./frankenphp php-cli /path/to/your/script.php
Enter fullscreen mode Exit fullscreen mode

Benefits of using FrankenPHP

There are many benefits to using FrankenPHP, including:

  • Improved performance: FrankenPHP can significantly improve the performance of your PHP app, especially in worker mode. Reduced complexity: FrankenPHP simplifies your deployment process by eliminating the need for separate PHP-FPM and Nginx processes.
  • Increased security: FrankenPHP automatically supports HTTPS, HTTP/2, and HTTP/3, which helps to keep your app secure.
  • More features: FrankenPHP offers several features that are not available in traditional PHP application servers, such as early hints and real-time capabilities.

Who should use FrankenPHP?

FrankenPHP is an excellent option for developers looking to enhance the performance, security, and simplicity of deploying their PHP applications. It is particularly well-suited for projects built with Symfony, Laravel, and WordPress.

Getting started with FrankenPHP

Starting with FrankenPHP is simple. Download the FrankenPHP binary from the website and follow the steps provided in the documentation. Additionally, there are numerous tutorials and blog posts available online to guide you through the process.

Conclusion

FrankenPHP is a robust and user-friendly application server designed for PHP. It enhances the performance, and security, and simplifies the deployment process of PHP applications. If you're seeking a cutting-edge solution to streamline your PHP development workflow, FrankenPHP is an excellent choice that offers both efficiency and modern features.

Additional resources
FrankenPHP website: https://frankenphp.dev/
FrankenPHP documentation: https://frankenphp.dev/docs/
FrankenPHP on GitHub: https://github.com/dunglas/frankenphp

Top comments (1)

Collapse
 
mehdi_hasanpour_abc9d2983 profile image
mehdi hasanpour

Thanks for great article. I should try it