FrankenPHP support is in beta and not yet feature-complete.
FrankenPHP is a modern application server for PHP built on top of the Caddy webserver
FrankenPHP requires a ZTS (Zend Thread Safety) build of the Blackfire PHP Probe, which you can install by following our installation guides.
Alternatively, you can use the FrankenPHP base Docker image:
1 2 3 4 5 6 7 8 9 10 11
Laravel Octane users: our integration supports Deterministic Profiling out of the box.
If you are not using Laravel Octane, update your FrankenPHP worker script to control the instrumentation manually:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
<?php
ignore_user_abort(true);
$handler = static function () {
echo 'Hello Blackfire!';
};
$blackfireMiddleware = static function () use ($handler) {
$probe = null;
// Only create a Blackfire probe if the Blackfire header is present
if (isset($_SERVER['HTTP_X_BLACKFIRE_QUERY'])) {
$probe = new \BlackfireProbe($_SERVER['HTTP_X_BLACKFIRE_QUERY']);
$probe->enable();
}
try {
$handler();
} catch (\Throwable $e) {
throw $e;
} finally {
if (probe) {
$probe->close();
}
}
};
// See https://frankenphp.dev/docs/worker/ for more information
$maxRequests = (int)($_SERVER['MAX_REQUESTS'] ?? 0);
for ($nbRequests = 0; !$maxRequests || $nbRequests < $maxRequests; ++$nbRequests) {
$keepRunning = \frankenphp_handle_request($blackfireMiddleware);
gc_collect_cycles();
if (!$keepRunning) break;
}
Learn more about controlling Deterministic Profiling using the PHP SDK.
Monitoring requires PHP Probe v1.92.44
or later.
Automatic profiling isn't supported yet.
FrankenPHP support is still in beta. If you run into a problem, please open a ticket on the Blackfire support site.