Skip to content

Commit 329568f

Browse files
Frankenphp documentation (#396)
1 parent c64b253 commit 329568f

File tree

3 files changed

+73
-2
lines changed

3 files changed

+73
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ You can run on Debian 10, by doing this setup before install: [Debian10 setup](.
6767
#### Deployment setup
6868
- [Caddy & PHP-FPM](./docs/caddy-php-fpm.md)
6969
- [Apache mod_php](./docs/apache-mod-php.md)
70-
- [FrannkenPHP classic](./docs/caddy-frankenphp-classic.md)
71-
- [FrannkenPHP worker](./docs/caddy-frankenphp-worker.md)
70+
- [FrankenPHP classic](./docs/frankenphp-classic.md)
71+
- [FrankenPHP worker](./docs/frankenphp-worker.md)
7272

7373
#### Managed platforms
7474
- [Laravel Forge](./docs/laravel-forge.md)

docs/frankenphp-classic.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# FrankenPHP (Classic Mode)
2+
3+
1. Pass the Aikido environment variables in your `Caddyfile`
4+
5+
`Caddyfile`
6+
```
7+
example.com {
8+
root * /var/www/html/public
9+
10+
php_server {
11+
env AIKIDO_TOKEN "AIK_RUNTIME_...."
12+
env AIKIDO_BLOCK "True"
13+
}
14+
15+
file_server
16+
}
17+
```
18+
19+
You can get your token from the [Aikido Security Dashboard](https://help.aikido.dev/doc/creating-an-aikido-zen-firewall-token/doc6vRJNzC4u).
20+
21+
2. Start FrankenPHP
22+
23+
`frankenphp run --config Caddyfile`

docs/frankenphp-worker.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# FrankenPHP (Worker Mode)
2+
3+
1. Pass the Aikido environment variables to FrankenPHP in your `Caddyfile` and configure the worker
4+
5+
`Caddyfile`
6+
```
7+
example.com {
8+
root * /var/www/html/public
9+
10+
php_server {
11+
env AIKIDO_TOKEN "AIK_RUNTIME_...."
12+
env AIKIDO_BLOCK "True"
13+
worker {
14+
// your worker parameters
15+
}
16+
}
17+
18+
file_server
19+
}
20+
```
21+
22+
You can get your token from the [Aikido Security Dashboard](https://help.aikido.dev/doc/creating-an-aikido-zen-firewall-token/doc6vRJNzC4u).
23+
24+
2. Call `\aikido\worker_rinit()` and `\aikido\worker_rshutdown()` in your worker script
25+
26+
Wrap your request handler with these calls to ensure Aikido processes each request.
27+
28+
`public/index.php`
29+
```php
30+
<?php
31+
32+
require __DIR__ . '/../vendor/autoload.php';
33+
$app = require_once __DIR__ . '/../bootstrap/app.php';
34+
35+
while (frankenphp_handle_request(function () use ($app) {
36+
\aikido\worker_rinit();
37+
38+
// Your application logic
39+
40+
\aikido\worker_rshutdown();
41+
})) {
42+
// keep looping
43+
}
44+
```
45+
46+
3. Start FrankenPHP
47+
48+
`frankenphp run --config Caddyfile`

0 commit comments

Comments
 (0)