# php/frankenphp

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/php-frankenphp).**

11,151 stars · 461 forks · Go · MIT

## Links

- GitHub: https://github.com/php/frankenphp
- Homepage: https://frankenphp.dev
- awesome-repositories: https://awesome-repositories.com/repository/php-frankenphp.md

## Topics

`caddy` `frankenphp` `go` `php` `sapi` `worker`

## Description

FrankenPHP is a Go-based PHP runtime and application server that integrates a web server and PHP interpreter to host applications without requiring a separate process manager. It functions as a worker mode server that keeps applications in memory across requests to eliminate bootstrap overhead and a static binary bundler that packages applications and the server into a single self-contained executable.

The project distinguishes itself by allowing the embedding of a PHP runtime directly into Go programs and enabling the development of PHP extensions using the Go language. It also includes a built-in real-time hub for pushing updates to clients via the Mercure protocol.

The server covers a broad range of operational capabilities, including worker thread scaling, request routing, and the delivery of early hint responses for asset preloading. It provides developer experience tools for automated hot reloading and worker restarts, alongside observability features such as thread state inspection and Prometheus metrics exposure.

Deployment is supported through container image building and the compilation of standalone static binaries using musl libc.

## Tags

### Programming Languages & Runtimes

- [PHP Application Servers](https://awesome-repositories.com/f/programming-languages-runtimes/php-application-servers.md) — Functions as a high-performance application server that integrates a PHP runtime to serve applications over HTTP. ([source](https://github.com/php/frankenphp/blob/main/frankenphp.go))
- [Runtime Embedding](https://awesome-repositories.com/f/programming-languages-runtimes/c-library-embedding/runtime-embedding.md) — Integrates a PHP interpreter into a Go application to serve requests via a native server API.
- [Cross-Language Runtime Integration](https://awesome-repositories.com/f/programming-languages-runtimes/cross-language-runtime-integration.md) — Embeds a PHP runtime directly into Go programs and enables PHP extension development using the Go language.
- [Go-Based Language Runtimes](https://awesome-repositories.com/f/programming-languages-runtimes/go-based-language-runtimes.md) — Provides a PHP runtime implemented in Go that allows embedding and extension development.
- [Go-Language Extensions](https://awesome-repositories.com/f/programming-languages-runtimes/php-extension-bindings/go-language-extensions.md) — Enables the creation of new PHP extensions using the Go programming language. ([source](https://github.com/php/frankenphp/blob/main/README.md))
- [Worker Mode Runtimes](https://awesome-repositories.com/f/programming-languages-runtimes/worker-mode-runtimes.md) — Maintains application state in memory across requests to eliminate bootstrap overhead.
- [Thread Local Storage](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/thread-local-storage.md) — Isolates environment variables on a per-thread basis to prevent race conditions during concurrent requests.
- [PHP Extension Bindings](https://awesome-repositories.com/f/programming-languages-runtimes/php-extension-bindings.md) — Provides the ability to load and register external PHP modules to extend the server runtime functionality. ([source](https://github.com/php/frankenphp/blob/main/ext.go))

### Web Development

- [In-Memory Worker Runtimes](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/in-memory-worker-runtimes.md) — Keeps applications bootloaded in memory across multiple requests to eliminate bootstrap overhead. ([source](https://github.com/php/frankenphp/blob/main/docs/config.md))
- [Request Dispatchers](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling/request-dispatchers.md) — Routes incoming HTTP requests to registered persistent worker threads for high-performance PHP execution. ([source](https://github.com/php/frankenphp/blob/main/workerextension.go))
- [Early Hints Implementations](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-utilities/http-response-builders/early-hints-implementations.md) — Sends 103 Early Hints status codes to browsers for asset preloading while the server continues processing.
- [Real-Time Communication](https://awesome-repositories.com/f/web-development/real-time-communication.md) — Includes a built-in hub that supports pushing real-time updates to clients via the Mercure protocol.
- [Real-Time Data Streaming](https://awesome-repositories.com/f/web-development/real-time-data-streaming.md) — Facilitates real-time data streaming between the server and clients for instant communication. ([source](https://github.com/php/frankenphp#readme))
- [Extension-Based Filtering](https://awesome-repositories.com/f/web-development/request-routing/path-prefix-matching/extension-based-filtering.md) — Matches incoming requests against specific file extensions and path patterns to determine server processing logic. ([source](https://github.com/php/frankenphp/blob/main/requestoptions_test.go))
- [Path-Based Routers](https://awesome-repositories.com/f/web-development/route-path-aliasing/path-based-routers.md) — Provides path-based routing to direct traffic to specific PHP worker scripts based on URL path prefixes. ([source](https://github.com/php/frankenphp/blob/main/cgi_test.go))
- [Automatic Process Restarters](https://awesome-repositories.com/f/web-development/static-file-servers/automatic-process-restarters.md) — Automatically restarts worker threads when source file changes are detected to speed up development. ([source](https://github.com/php/frankenphp/blob/main/docs/config.md))

### Development Tools & Productivity

- [Static Binaries](https://awesome-repositories.com/f/development-tools-productivity/static-binaries.md) — Compiles the server and PHP application into a single standalone executable using musl libc.
- [Static Binary Compilers](https://awesome-repositories.com/f/development-tools-productivity/static-binaries/static-binary-compilers.md) — Compiles the application server into a standalone static binary using musl libc. ([source](https://github.com/php/frankenphp/blob/main/static-builder-gnu.Dockerfile))
- [Development Iteration Workflows](https://awesome-repositories.com/f/development-tools-productivity/development-iteration-workflows.md) — Provides a rapid iteration loop with automatic server restarts and hot reloading of source files.
- [Hot Code Reloading](https://awesome-repositories.com/f/development-tools-productivity/hot-code-reloading.md) — Monitors filesystem changes to automatically restart worker threads and refresh application state.

### DevOps & Infrastructure

- [Binary Bundlers](https://awesome-repositories.com/f/devops-infrastructure/php-application-deployments/binary-bundlers.md) — Packages the server and application source into a single standalone executable.
- [Self-Contained Deployments](https://awesome-repositories.com/f/devops-infrastructure/self-contained-deployments.md) — Bundles a PHP application and its server into a single binary for simplified installation and distribution.
- [Thread-Local Isolation](https://awesome-repositories.com/f/devops-infrastructure/environment-variables/thread-local-isolation.md) — Isolates environment variables per thread to ensure request-specific configuration and prevent race conditions. ([source](https://github.com/php/frankenphp/blob/main/docs/internals.md))
- [Thread Scaling](https://awesome-repositories.com/f/devops-infrastructure/process-scaling/thread-scaling.md) — Adjusts the number of active worker threads based on load to optimize resource usage. ([source](https://github.com/php/frankenphp/blob/main/scaling_test.go))
- [Dedicated Worker Routing](https://awesome-repositories.com/f/devops-infrastructure/worker-node-management/worker-groupings/dedicated-worker-routing.md) — Maps incoming request path patterns to dedicated worker scripts to handle different application segments. ([source](https://github.com/php/frankenphp/blob/main/docs/config.md))

### Software Engineering & Architecture

- [Standalone Runtime Bundling](https://awesome-repositories.com/f/software-engineering-architecture/embedded-runtimes/standalone-runtime-bundling.md) — Packages the PHP application and the full runtime into a single executable for dependency-free distribution. ([source](https://github.com/php/frankenphp/blob/main/README.md))
- [Cross-Language Type Translation](https://awesome-repositories.com/f/software-engineering-architecture/native-bridges/native-bridge-memory-management/cross-language-type-translation.md) — Translates complex data types like associative arrays and strings between Go and PHP memory representations.

### Part of an Awesome List

- [Runtime Parameter Tuning](https://awesome-repositories.com/f/awesome-lists/devops/php-installation/php-runtime-management/runtime-parameter-tuning.md) — Allows fine-tuning of execution threads, request timeouts, and PHP ini settings. ([source](https://github.com/php/frankenphp/blob/main/docs/config.md))

### Hardware & IoT

- [Application Binary Embedding](https://awesome-repositories.com/f/hardware-iot/binary-embedded-file-systems/application-binary-embedding.md) — Bundles PHP applications directly into the server binary for self-contained deployment. ([source](https://github.com/php/frankenphp/blob/main/embed.go))

### Networking & Communication

- [Real-time Notification Broadcasters](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/real-time-notification-broadcasters.md) — Sends real-time data updates to specific topics via a hub for instant client notifications. ([source](https://github.com/php/frankenphp/blob/main/frankenphp.stub.php))
- [Mercure Hub Integrations](https://awesome-repositories.com/f/networking-communication/mercure-hub-integrations.md) — Integrates a built-in hub for pushing real-time updates to clients via the Mercure protocol. ([source](https://github.com/php/frankenphp/blob/main/frankenphp_arginfo.h))

### Operating Systems & Systems Programming

- [Language Memory Bridges](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/memory-safety-and-semantics/cross-language-memory-managers/language-memory-bridges.md) — Implements memory bridges to translate complex data types like associative arrays between Go and PHP representations. ([source](https://github.com/php/frankenphp/blob/main/types_test.go))
