FrankenPHP

website·Indexed 36 days ago

https://frankenphp.dev

A modern PHP application server written in Go and powered by Caddy.

Tokens
427
Snippets
0
Records
4
Agent score
23%

What's inside FrankenPHP

  1. Overview of FrankenPHP features

    FrankenPHP is a modern PHP application server written in Go and powered by Caddy. It provides several key features for PHP development and deployment:

    • Automatic HTTPS, HTTP/2, and HTTP/3 support.
    • In-memory worker mode to keep applications bootstrapped between requests for lower latency.
    • Real-time updates via the built-in Mercure hub.
    • Hot reload capabilities for PHP, templates, and frontend assets.
    • Ability to deploy as a static binary, embedding PHP and Caddy into a single executable.
  2. Deploy PHP applications as standalone static binaries

    FrankenPHP allows developers to ship pure-PHP applications, as well as those built with Symfony or Laravel, as a single self-contained static executable. This binary embeds both the PHP runtime and the Caddy web server, simplifying deployment by removing the need for external dependencies on the target server.
  3. Integrate PHP with Go using FrankenPHP

    FrankenPHP provides advanced integration capabilities between Go and PHP:

    • Use as a Go library: Embed PHP directly into any Go program and serve scripts through net/http.
    • Writing PHP Extensions in Go: Use the extension generator and types API to call PHP from Go, including the creation of classes, methods, and constants.
    • Extension Workers: Create a dedicated PHP thread pool from a Go extension to handle background tasks such as queues, schedulers, and event listeners.
  4. Choose between FrankenPHP Classic and Worker modes

    FrankenPHP offers two primary execution modes depending on performance and compatibility needs:

    • Classic Mode: A drop-in replacement for PHP-FPM and Apache mod_php. It uses a fixed or autoscaling thread pool to handle requests.
    • Worker Mode: Keeps the PHP application bootstrapped in memory between requests, significantly reducing latency by avoiding the overhead of restarting the application on every request.