Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Innmind/HttpFramework

Repository files navigation

Http framework

Build Status codecov Type Coverage

Library to formalize http request handling and provide generic tools such as routing.

Installation

composer require innmind/http-framework

Usage

<?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),
                        ),
                    ),
                );
            });
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages