Skip to content

Commit 24be668

Browse files
authored
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.
1 parent 2ac6c41 commit 24be668

28 files changed

Lines changed: 436 additions & 216 deletions

.gitleaksignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/github/workspace/docs/mercure.md:jwt:88
2-
/github/workspace/docs/mercure.md:jwt:90
1+
/github/workspace/docs/mercure.md:jwt:95

.markdown-lint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
MD010: false
33
MD013: false
4+
MD025:
5+
front_matter_title: ""
46
MD033: false
57
MD060: false

docs/classic.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Using Classic Mode
1+
---
2+
title: FrankenPHP classic mode: drop-in PHP-FPM replacement
3+
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
27

38
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.
49

docs/compile.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff 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+
---
25

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.
49
This is the recommended method.
510

611
Alternatively, [fully and mostly static builds](static.md) can also be created.
@@ -22,7 +27,7 @@ brew install shivammathur/php/php-zts brotli watcher
2227
brew link --overwrite --force shivammathur/php/php-zts
2328
```
2429

25-
### By Compiling PHP
30+
### By compiling PHP
2631

2732
Alternatively, you can compile PHP from sources with the options needed by FrankenPHP by following these steps.
2833

@@ -36,7 +41,7 @@ cd php-*/
3641
Then, run the `configure` script with the options needed for your platform.
3742
The following `./configure` flags are mandatory, but you can add others, for example, to compile extensions or additional features.
3843

39-
#### Linux
44+
#### Linux and FreeBSD
4045

4146
```console
4247
./configure \
@@ -74,7 +79,7 @@ make -j"$(getconf _NPROCESSORS_ONLN)"
7479
sudo make install
7580
```
7681

77-
## Install Optional Dependencies
82+
## Install optional dependencies
7883

7984
Some FrankenPHP features depend on optional system dependencies that must be installed.
8085
Alternatively, these features can be disabled by passing build tags to the Go compiler.
@@ -85,7 +90,7 @@ Alternatively, these features can be disabled by passing build tags to the Go co
8590
| Restart workers on file change | [Watcher C](https://github.com/e-dant/watcher/tree/release/watcher-c) | nowatcher |
8691
| [Mercure](mercure.md) | [Mercure Go library](https://pkg.go.dev/github.com/dunglas/mercure) (automatically installed, AGPL licensed) | nomercure |
8792

88-
## Compile the Go App
93+
## Compile the Go app
8994

9095
You can now build the final binary.
9196

docs/config.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff 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+
16
# Configuration
27

38
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:
7378
- PHP extensions: cannot be loaded, bundle them in the binary itself
7479
- copy one of `php.ini-production` or `php.ini-development` provided [in the PHP sources](https://github.com/php/php-src/).
7580

76-
## Caddyfile Config
81+
## Caddyfile config
7782

7883
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.
7984

@@ -196,7 +201,7 @@ php_server [<matcher>] {
196201
}
197202
```
198203

199-
### Watching for File Changes
204+
### Watching for file changes
200205

201206
Since workers only boot your application once and keep it in memory, any changes
202207
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
243248

244249
The file watcher is based on [e-dant/watcher](https://github.com/e-dant/watcher).
245250

246-
## Matching the Worker To a Path
251+
## Matching the worker to a path
247252

248253
In traditional PHP applications, scripts are always placed in the public directory.
249254
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.
266271
}
267272
```
268273

269-
## Restarting Threads After a Number of Requests (Experimental)
274+
## Restarting threads after a number of requests (experimental)
270275

271276
FrankenPHP can automatically restart PHP threads after they have handled a given number of requests.
272277
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,
285290
}
286291
```
287292

288-
## Environment Variables
293+
## Environment variables
289294

290295
The following environment variables can be used to inject Caddy directives in the `Caddyfile` without modifying it:
291296

@@ -302,7 +307,7 @@ The `S` value of [the `variables_order` PHP directive](https://www.php.net/manua
302307

303308
To load [additional PHP configuration files](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
304309
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.
306311

307312
You can also change the PHP configuration using the `php_ini` directive in the `Caddyfile`:
308313

@@ -323,14 +328,14 @@ You can also change the PHP configuration using the `php_ini` directive in the `
323328

324329
### Disabling HTTPS
325330

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`.
327332
If you want to disable HTTPS (for example in a development environment), you can set the `SERVER_NAME` environment variable to `http://` or `:80`:
328333

329334
Alternatively, you can use all other methods described in the [Caddy documentation](https://caddyserver.com/docs/automatic-https#activation).
330335

331336
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.
332337

333-
### Full Duplex (HTTP/1)
338+
### Full duplex (HTTP/1)
334339

335340
When using HTTP/1.x, it may be desirable to enable full-duplex mode to allow writing a response before the entire body
336341
has been read. (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.)
@@ -358,7 +363,7 @@ CADDY_GLOBAL_OPTIONS="servers {
358363

359364
You can find more information about this setting in the [Caddy documentation](https://caddyserver.com/docs/caddyfile/options#enable-full-duplex).
360365

361-
## Enable the Debug Mode
366+
## Enable the debug mode
362367

363368
When using the Docker image, set the `CADDY_GLOBAL_OPTIONS` environment variable to `debug` to enable the debug mode:
364369

@@ -369,7 +374,7 @@ docker run -v $PWD:/app/public \
369374
dunglas/frankenphp
370375
```
371376

372-
## Shell Completion
377+
## Shell completion
373378

374379
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.
375380

@@ -441,5 +446,3 @@ Add-Content -Path $PROFILE -Value '. (Join-Path (Split-Path $PROFILE) "frankenph
441446
```
442447

443448
You will need to start a new shell for this setup to take effect.
444-
445-
You will need to start a new shell for this setup to take effect.

docs/docker.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Building Custom Docker Image
1+
---
2+
title: FrankenPHP Docker image: build, configure, extend
3+
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
27

38
[FrankenPHP Docker images](https://hub.docker.com/r/dunglas/frankenphp) are based on [official PHP images](https://hub.docker.com/_/php/).
49
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
1318

1419
[Browse tags](https://hub.docker.com/r/dunglas/frankenphp/tags).
1520

16-
## How to Use The Images
21+
## How to use the FrankenPHP Docker images
1722

1823
Create a `Dockerfile` in your project:
1924

@@ -30,12 +35,12 @@ docker build -t my-php-app .
3035
docker run -it --rm --name my-running-app my-php-app
3136
```
3237

33-
## How to Tweak the Configuration
38+
## How to tweak the FrankenPHP Docker configuration
3439

3540
For convenience, [a default `Caddyfile`](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile) containing
3641
useful environment variables is provided in the image.
3742

38-
## How to Install More PHP Extensions
43+
## How to install more PHP extensions
3944

4045
The [`docker-php-extension-installer`](https://github.com/mlocati/docker-php-extension-installer) script is provided in the base image.
4146
Adding additional PHP extensions is straightforward:
@@ -52,7 +57,7 @@ RUN install-php-extensions \
5257
opcache
5358
```
5459

55-
## How to Install More Caddy Modules
60+
## How to install more Caddy modules
5661

5762
FrankenPHP is built on top of Caddy, and all [Caddy modules](https://caddyserver.com/docs/modules/) can be used with FrankenPHP.
5863

@@ -82,7 +87,7 @@ RUN CGO_ENABLED=1 \
8287

8388
FROM dunglas/frankenphp AS runner
8489

85-
# Replace the official binary by the one contained your custom modules
90+
# Replace the official binary with the one containing your custom modules
8691
COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp
8792
```
8893

@@ -94,7 +99,7 @@ The `builder` image provided by FrankenPHP contains a compiled version of `libph
9499
> If you're using Alpine Linux and Symfony,
95100
> you may need to [increase the default stack size](compile.md#using-xcaddy).
96101
97-
## Enabling the Worker Mode by Default
102+
## Enabling the worker mode by default
98103

99104
Set the `FRANKENPHP_CONFIG` environment variable to start FrankenPHP with a worker script:
100105

@@ -106,7 +111,7 @@ FROM dunglas/frankenphp
106111
ENV FRANKENPHP_CONFIG="worker ./public/index.php"
107112
```
108113

109-
## Using a Volume in Development
114+
## Using a volume in development
110115

111116
To develop easily with FrankenPHP, mount the directory from your host containing the source code of the app as a volume in the Docker container:
112117

@@ -147,9 +152,9 @@ volumes:
147152
caddy_config:
148153
```
149154
150-
## Running as a Non-Root User
155+
## Running as a non-root user
151156
152-
FrankenPHP can run as non-root user in Docker.
157+
FrankenPHP can run as a non-root user in Docker.
153158
154159
Here is a sample `Dockerfile` doing this:
155160

@@ -170,7 +175,7 @@ EOF
170175
USER ${USER}
171176
```
172177

173-
### Running With No Capabilities
178+
### Running with no capabilities
174179

175180
Even when running rootless, FrankenPHP needs the `CAP_NET_BIND_SERVICE` capability to bind the
176181
web server on privileged ports (80 and 443).
@@ -198,14 +203,14 @@ USER ${USER}
198203
Next, set the `SERVER_NAME` environment variable to use an unprivileged port.
199204
Example: `:8000`
200205

201-
## Updates
206+
## FrankenPHP Docker image updates
202207

203208
The Docker images are built:
204209

205210
- when a new release is tagged
206211
- daily at 4 am UTC, if new versions of the official PHP images are available
207212

208-
## Hardening Images
213+
## Hardening images
209214

210215
To further reduce the attack surface and size of your FrankenPHP Docker images, it's also possible to build them on top of a
211216
[Google distroless](https://github.com/GoogleContainerTools/distroless) or
@@ -265,7 +270,7 @@ WORKDIR /app
265270
ENTRYPOINT ["/usr/local/bin/frankenphp", "run", "--config", "/etc/caddy/Caddyfile"]
266271
```
267272

268-
## Development Versions
273+
## Development versions
269274

270275
Development versions are available in the [`dunglas/frankenphp-dev`](https://hub.docker.com/repository/docker/dunglas/frankenphp-dev) Docker repository.
271276
A new build is triggered every time a commit is pushed to the main branch of the GitHub repository.

docs/early-hints.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
16
# Early Hints
27

38
FrankenPHP natively supports the [103 Early Hints status code](https://developer.chrome.com/blog/early-hints/).

docs/embed.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff 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
27

38
FrankenPHP has the ability to embed the source code and assets of PHP applications in a static, self-contained binary.
49

@@ -8,7 +13,7 @@ Learn more about this feature [in the presentation made by Kévin at SymfonyCon
813

914
For embedding Laravel applications, [read this specific documentation entry](laravel.md#laravel-apps-as-standalone-binaries).
1015

11-
## Preparing Your App
16+
## Preparing your app
1217

1318
Before creating the self-contained binary be sure that your app is ready for embedding.
1419

@@ -42,18 +47,19 @@ composer install --ignore-platform-reqs --no-dev -a
4247
composer dump-env prod
4348
```
4449

45-
### Customizing the Configuration
50+
### Customizing the configuration
4651

4752
To customize [the configuration](config.md), you can put a `Caddyfile` as well as a `php.ini` file
4853
in the main directory of the app to be embedded (`$TMPDIR/my-prepared-app` in the previous example).
4954

50-
## Creating a Linux Binary
55+
## Creating a Linux binary
5156

5257
The easiest way to create a Linux binary is to use the Docker-based builder we provide.
5358

5459
1. Create a file named `static-build.Dockerfile` in the repository of your app:
5560

5661
```dockerfile
62+
# static-build.Dockerfile
5763
FROM --platform=linux/amd64 dunglas/frankenphp:static-builder-gnu
5864
# If you intend to run the binary on musl-libc systems, use static-builder-musl instead
5965

@@ -85,7 +91,7 @@ The easiest way to create a Linux binary is to use the Docker-based builder we p
8591

8692
The resulting binary is the file named `my-app` in the current directory.
8793

88-
## Creating a Binary for Other OSes
94+
## Creating a binary for other OSes
8995

9096
If you don't want to use Docker, or want to build a macOS binary, use the shell script we provide:
9197

@@ -97,7 +103,7 @@ EMBED=/path/to/your/app ./build-static.sh
97103

98104
The resulting binary is the file named `frankenphp-<os>-<arch>` in the `dist/` directory.
99105

100-
## Using The Binary
106+
## Using the binary
101107

102108
This is it! The `my-app` file (or `dist/frankenphp-<os>-<arch>` on other OSes) contains your self-contained app!
103109

@@ -125,18 +131,18 @@ You can also run the PHP CLI scripts embedded in your binary:
125131
./my-app php-cli bin/console
126132
```
127133

128-
## PHP Extensions
134+
## PHP extensions
129135

130136
By default, the script will build extensions required by the `composer.json` file of your project, if any.
131137
If the `composer.json` file doesn't exist, the default extensions are built, as documented in [the static builds entry](static.md).
132138

133139
To customize the extensions, use the `PHP_EXTENSIONS` environment variable.
134140

135-
## Customizing The Build
141+
## Customizing the build
136142

137143
[Read the static build documentation](static.md) to see how to customize the binary (extensions, PHP version...).
138144

139-
## Distributing The Binary
145+
## Distributing the binary
140146

141147
On Linux, the created binary is compressed using [UPX](https://upx.github.io).
142148

0 commit comments

Comments
 (0)