2024-08-29 13:06:57 +01:00

30 lines
592 B
PHP

<?php
require "vendor/autoload.php";
use Dumbo\Dumbo;
use Dumbo\Helpers\RequestId;
$app = new Dumbo();
$app->use(RequestId::requestId());
// Or apply it with custom options
// $app->use(
// RequestId::requestId([
// "headerName" => "X-Custom-Request-Id",
// "limitLength" => 128,
// "generator" => function ($ctx) {
// return uniqid("custom-", true);
// },
// ])
// );
$app->get("/", function ($context) {
$requestId = $context->get("requestId");
return $context->text("Your request ID is: " . $requestId);
});
$app->run();