mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-17 06:08:31 +01:00
30 lines
607 B
PHP
30 lines
607 B
PHP
<?php
|
|
|
|
require __DIR__ . "/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 ($context) {
|
|
// return uniqid("custom-", true);
|
|
// },
|
|
// ])
|
|
// );
|
|
|
|
$app->get("/", function ($context) {
|
|
$requestId = $context->get("requestId");
|
|
|
|
return $context->text("Your request ID is: " . $requestId);
|
|
});
|
|
|
|
$app->run();
|