PHP Handler Template¶
Verified status as of March 28, 2026. Runtime note: FastFN auto-installs function-local dependencies from
requirements.txt/package.json; host runtimes are required infastfn dev --native, whilefastfn devdepends on a running Docker daemon. Runtime internals: FastFN talks tophp-daemon.php, which fans out to isolatedphp-worker.phpchild processes per handler path. That split is internal and keeps PHP handlers isolated from each other. PHP runtime is implemented. Use this template forhandler.php.
php-handler.php
<?php
function handler(array $event): array {
$query = $event['query'] ?? [];
$name = $query['name'] ?? 'world';
return [
'status' => 200,
'headers' => [
'Content-Type' => 'application/json',
],
'body' => json_encode([
'runtime' => 'php',
'hello' => $name,
]),
];
}
Contract¶
Defines expected request/response shape, configuration fields, and behavioral guarantees.
End-to-End Example¶
Use the examples in this page as canonical templates for implementation and testing.
Edge Cases¶
- Missing configuration fallbacks
- Route conflicts and precedence
- Runtime-specific nuances
See also¶
Last reviewed:
March 28, 2026
·
Docs on fastfn.dev