Skip to content

Commit 475aabf

Browse files
committed
review
1 parent 2c8c26f commit 475aabf

1 file changed

Lines changed: 16 additions & 71 deletions

File tree

docs/symfony.md

Lines changed: 16 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,16 @@ For [Symfony](https://symfony.com) projects, we recommend using [Symfony Docker]
88

99
Alternatively, you can run your Symfony projects with FrankenPHP from your local machine:
1010

11-
1. [Download the binary corresponding to your system](../README.md#standalone-binary)
11+
1. [Install FrankenPHP](../#getting-started)
1212
2. Add the following configuration to a file named `Caddyfile` in the root directory of your Symfony project:
1313

1414
```caddyfile
1515
# The domain name of your server
16-
localhost {
17-
# Set the webroot to the public/ directory
18-
root public/
19-
# Enable compression (optional)
20-
encode zstd br gzip
21-
22-
23-
# Rewrite requests to non-existing files to the front controller
24-
@phpRoute {
25-
not file {path}
26-
}
27-
rewrite @phpRoute index.php
28-
29-
@frontController path index.php
30-
php @frontController {
31-
# Optional: Enable worker mode for better performance
32-
worker {
33-
file ./public/index.php
34-
}
35-
}
36-
37-
file_server {
38-
hide *.php
39-
}
16+
localhost
17+
18+
php_server {
19+
# Optional: Enable worker mode for better performance
20+
worker index.php
4021
}
4122
```
4223

@@ -71,7 +52,7 @@ Learn more about [the worker mode](worker.md).
7152

7253
Hot reloading is enabled by default in [Symfony Docker](https://github.com/dunglas/symfony-docker).
7354

74-
To use the [hot reload](hot-reload.md) feature without Symfony Docker, enable [Mercure](mercure.md) and add the `hot_reload` sub-directive to the `php` directive in your `Caddyfile`:
55+
To use the [hot reload](hot-reload.md) feature without Symfony Docker, enable [Mercure](mercure.md) and add the `hot_reload` sub-directive to the `php_server` directive in your `Caddyfile`:
7556

7657
```caddyfile
7758
localhost
@@ -80,26 +61,9 @@ mercure {
8061
anonymous
8162
}
8263
83-
root public/
84-
85-
@phpRoute {
86-
not path /.well-known/mercure*
87-
not file {path}
88-
}
89-
rewrite @phpRoute index.php
90-
91-
@frontController path index.php
92-
php @frontController {
64+
php_server {
9365
hot_reload
94-
# Optional: enable worker in watch mode for better performance
95-
worker {
96-
file ./public/index.php
97-
watch
98-
}
99-
}
100-
101-
file_server {
102-
hide *.php
66+
worker index.php
10367
}
10468
```
10569

@@ -128,34 +92,15 @@ Symfony's [AssetMapper component](https://symfony.com/doc/current/frontend/asset
12892
2. Update your `Caddyfile` to serve pre-compressed assets:
12993

13094
```caddyfile
131-
{
132-
frankenphp
95+
localhost
96+
97+
@assets path /assets/*
98+
file_server @assets {
99+
precompressed zstd br gzip
133100
}
134101
135-
localhost {
136-
root public/
137-
138-
@phpRoute {
139-
not file {path}
140-
}
141-
rewrite @phpRoute index.php
142-
143-
@frontController path index.php
144-
php @frontController {
145-
# Optional: Enable worker mode for better performance
146-
worker {
147-
file ./public/index.php
148-
}
149-
}
150-
151-
@assets path /assets/*
152-
file_server @assets {
153-
precompressed zstd br gzip
154-
}
155-
156-
file_server {
157-
hide *.php
158-
}
102+
php_server {
103+
worker index.php
159104
}
160105
```
161106

0 commit comments

Comments
 (0)