Library to formalize http request handling and provide generic tools such as routing.
composer require innmind/http-framework
<?php
# index.php
use function Innmind\HttpFramework\bootstrap;
use Innmind\HttpFramework\{
Controller,
Application,
Main,
};
use Innmind\Url\Path;
use Innmind\Immutable\Map;
new class extends Main {
protected function configure(Application $app): Application
{
return $app
->configAt(Path::of('/folder/containing/dotenv_file/'))
->handler(static function($os, $env) {
$framework = bootstrap();
return $framework['enforce_https'](
$framework['authenticate']($authenticator, $condition)(
$framework['router'](
/* instance of Innmind\Router\RequestMatcher */,
Map::of('string', Controller::class),
),
),
);
});
}
}