You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add SEO frontmatter, llms.txt, and code-block hygiene (#2394)
## Summary
- Adds YAML frontmatter (`title`, `description`) to every English doc
under `docs/*.md` for SEO and LLM/RAG ingestion.
- Renames generic headings (`## Setup`, `## Configuration`, etc.) to
topic-specific ones; updates the one inbound cross-link affected by an
anchor rename.
- Tightens code blocks: language tags fixed where wrong (e.g. `console`
→ `bash`, `caddy` → `caddyfile`), and a first-line filename or purpose
comment added on blocks that represent a real file.
- Adds a root `llms.txt` index pointing AI agents at the canonical
English docs (Core Concepts, Setup and Build, Worker Mode and
Extensions, Frameworks, Real-Time and Performance, Production and
Observability).
## Notes
- Translations under `docs/<lang>/` are intentionally untouched. Re-run
`docs/translate.php` after merge to propagate the new frontmatter and
renamed headings.
- Anchor renames are scoped to genuinely generic headings;
already-specific ones were left alone.
description: Run FrankenPHP in classic mode as a drop-in replacement for PHP-FPM or Apache mod_php, with a fixed or autoscaling thread pool serving PHP files directly.
4
+
---
5
+
6
+
# Using classic mode
2
7
3
8
Without any additional configuration, FrankenPHP operates in classic mode. In this mode, FrankenPHP functions like a traditional PHP server, directly serving PHP files. This makes it a seamless drop-in replacement for PHP-FPM or Apache with mod_php.
Copy file name to clipboardExpand all lines: docs/compile.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
-
# Compile From Sources
1
+
---
2
+
title: Compile FrankenPHP from sources with libphp.so
3
+
description: Build FrankenPHP from source on Linux, macOS and FreeBSD, linking PHP as a shared library via xcaddy or go build, and add custom Caddy modules and extensions.
4
+
---
2
5
3
-
This document explains how to create a FrankenPHP binary that will load PHP as a dynamic library.
6
+
# Compile from sources
7
+
8
+
This document explains how to create a FrankenPHP binary that will load PHP as a shared library.
4
9
This is the recommended method.
5
10
6
11
Alternatively, [fully and mostly static builds](static.md) can also be created.
Copy file name to clipboardExpand all lines: docs/config.md
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
---
2
+
title: Configuring FrankenPHP with Caddyfile, php.ini, and env vars
3
+
description: Configure FrankenPHP and Caddy via Caddyfile, JSON, or environment variables, including PHP runtime tuning, worker mode, file watching, and module options.
4
+
---
5
+
1
6
# Configuration
2
7
3
8
FrankenPHP, Caddy as well as the [Mercure](mercure.md) and [Vulcain](https://vulcain.rocks) modules can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).
@@ -73,7 +78,7 @@ PHP:
73
78
- PHP extensions: cannot be loaded, bundle them in the binary itself
74
79
- copy one of `php.ini-production` or `php.ini-development` provided [in the PHP sources](https://github.com/php/php-src/).
75
80
76
-
## Caddyfile Config
81
+
## Caddyfile config
77
82
78
83
The `php_server` or the `php`[HTTP directives](https://caddyserver.com/docs/caddyfile/concepts#directives) may be used within the site blocks to serve your PHP app.
79
84
@@ -196,7 +201,7 @@ php_server [<matcher>] {
196
201
}
197
202
```
198
203
199
-
### Watching for File Changes
204
+
### Watching for file changes
200
205
201
206
Since workers only boot your application once and keep it in memory, any changes
202
207
to your PHP files will not be reflected immediately.
@@ -243,7 +248,7 @@ where the FrankenPHP process was started. You can instead also specify one or mo
243
248
244
249
The file watcher is based on [e-dant/watcher](https://github.com/e-dant/watcher).
245
250
246
-
## Matching the Worker To a Path
251
+
## Matching the worker to a path
247
252
248
253
In traditional PHP applications, scripts are always placed in the public directory.
249
254
This is also true for worker scripts, which are treated like any other PHP script.
@@ -266,7 +271,7 @@ and otherwise forward the request to the worker matching the path pattern.
266
271
}
267
272
```
268
273
269
-
## Restarting Threads After a Number of Requests (Experimental)
274
+
## Restarting threads after a number of requests (experimental)
270
275
271
276
FrankenPHP can automatically restart PHP threads after they have handled a given number of requests.
272
277
When a thread reaches the limit, it is fully restarted,
@@ -285,7 +290,7 @@ But when the fix depends on a third party you don't control,
285
290
}
286
291
```
287
292
288
-
## Environment Variables
293
+
## Environment variables
289
294
290
295
The following environment variables can be used to inject Caddy directives in the `Caddyfile` without modifying it:
291
296
@@ -302,7 +307,7 @@ The `S` value of [the `variables_order` PHP directive](https://www.php.net/manua
302
307
303
308
To load [additional PHP configuration files](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
304
309
the `PHP_INI_SCAN_DIR` environment variable can be used.
305
-
When set, PHP will load all the file with the `.ini` extension present in the given directories.
310
+
When set, PHP will load all the files with the `.ini` extension present in the given directories.
306
311
307
312
You can also change the PHP configuration using the `php_ini` directive in the `Caddyfile`:
308
313
@@ -323,14 +328,14 @@ You can also change the PHP configuration using the `php_ini` directive in the `
323
328
324
329
### Disabling HTTPS
325
330
326
-
By default, FrankenPHP will automatically enable HTTPS using for all the hostnames, including `localhost`.
331
+
By default, FrankenPHP will automatically enable HTTPS for all the hostnames, including `localhost`.
327
332
If you want to disable HTTPS (for example in a development environment), you can set the `SERVER_NAME` environment variable to `http://` or `:80`:
328
333
329
334
Alternatively, you can use all other methods described in the [Caddy documentation](https://caddyserver.com/docs/automatic-https#activation).
330
335
331
336
If you want to use HTTPS with the `127.0.0.1` IP address instead of the `localhost` hostname, please read the [known issues](known-issues.md#using-https127001-with-docker) section.
332
337
333
-
### Full Duplex (HTTP/1)
338
+
### Full duplex (HTTP/1)
334
339
335
340
When using HTTP/1.x, it may be desirable to enable full-duplex mode to allow writing a response before the entire body
336
341
has been read. (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.)
You can find more information about this setting in the [Caddy documentation](https://caddyserver.com/docs/caddyfile/options#enable-full-duplex).
360
365
361
-
## Enable the Debug Mode
366
+
## Enable the debug mode
362
367
363
368
When using the Docker image, set the `CADDY_GLOBAL_OPTIONS` environment variable to `debug` to enable the debug mode:
364
369
@@ -369,7 +374,7 @@ docker run -v $PWD:/app/public \
369
374
dunglas/frankenphp
370
375
```
371
376
372
-
## Shell Completion
377
+
## Shell completion
373
378
374
379
FrankenPHP provides built-in shell completion support for Bash, Zsh, Fish, and PowerShell. This enables autocompletion for all commands (including custom commands like `php-server`, `php-cli`, and `extension-init`) and their flags.
description: Build custom FrankenPHP Docker images, install PHP extensions and Caddy modules, run as non-root, harden with distroless, and enable worker mode by default.
4
+
---
5
+
6
+
# Building a custom Docker image
2
7
3
8
[FrankenPHP Docker images](https://hub.docker.com/r/dunglas/frankenphp) are based on [official PHP images](https://hub.docker.com/_/php/).
4
9
Debian and Alpine Linux variants are provided for popular architectures.
@@ -13,7 +18,7 @@ The tags follow this pattern: `dunglas/frankenphp:<frankenphp-version>-php<php-v
Development versions are available in the [`dunglas/frankenphp-dev`](https://hub.docker.com/repository/docker/dunglas/frankenphp-dev) Docker repository.
271
276
A new build is triggered every time a commit is pushed to the main branch of the GitHub repository.
Copy file name to clipboardExpand all lines: docs/early-hints.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
---
2
+
title: Sending HTTP 103 Early Hints from PHP with FrankenPHP
3
+
description: FrankenPHP natively supports the HTTP 103 Early Hints status code, letting PHP applications preload assets before the final response is ready.
4
+
---
5
+
1
6
# Early Hints
2
7
3
8
FrankenPHP natively supports the [103 Early Hints status code](https://developer.chrome.com/blog/early-hints/).
Copy file name to clipboardExpand all lines: docs/embed.md
+15-9Lines changed: 15 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,9 @@
1
-
# PHP Apps As Standalone Binaries
1
+
---
2
+
title: Embedding PHP apps as standalone binaries with FrankenPHP
3
+
description: How to package a PHP application (including Symfony or Laravel) as a self-contained static binary with FrankenPHP, the PHP interpreter, PHP extensions and Caddy.
4
+
---
5
+
6
+
# PHP apps as standalone binaries
2
7
3
8
FrankenPHP has the ability to embed the source code and assets of PHP applications in a static, self-contained binary.
4
9
@@ -8,7 +13,7 @@ Learn more about this feature [in the presentation made by Kévin at SymfonyCon
8
13
9
14
For embedding Laravel applications, [read this specific documentation entry](laravel.md#laravel-apps-as-standalone-binaries).
10
15
11
-
## Preparing Your App
16
+
## Preparing your app
12
17
13
18
Before creating the self-contained binary be sure that your app is ready for embedding.
14
19
@@ -42,18 +47,19 @@ composer install --ignore-platform-reqs --no-dev -a
42
47
composer dump-env prod
43
48
```
44
49
45
-
### Customizing the Configuration
50
+
### Customizing the configuration
46
51
47
52
To customize [the configuration](config.md), you can put a `Caddyfile` as well as a `php.ini` file
48
53
in the main directory of the app to be embedded (`$TMPDIR/my-prepared-app` in the previous example).
49
54
50
-
## Creating a Linux Binary
55
+
## Creating a Linux binary
51
56
52
57
The easiest way to create a Linux binary is to use the Docker-based builder we provide.
53
58
54
59
1. Create a file named `static-build.Dockerfile` in the repository of your app:
55
60
56
61
```dockerfile
62
+
# static-build.Dockerfile
57
63
FROM --platform=linux/amd64 dunglas/frankenphp:static-builder-gnu
58
64
# If you intend to run the binary on musl-libc systems, use static-builder-musl instead
59
65
@@ -85,7 +91,7 @@ The easiest way to create a Linux binary is to use the Docker-based builder we p
85
91
86
92
The resulting binary is the file named `my-app` in the current directory.
87
93
88
-
## Creating a Binary for Other OSes
94
+
## Creating a binary for other OSes
89
95
90
96
If you don't want to use Docker, or want to build a macOS binary, use the shell script we provide:
0 commit comments