innmind/http-server

Http server

4.1.0 2024-03-10 14:49 UTC

This package is auto-updated.

Last update: 2024-12-10 16:32:11 UTC


README

Build Status Type Coverage

Entry point to build an HTTP server.

Installation

composer require innmind/http-server

Usage

require 'vendor/autoload.php';

use Innmind\HttpServer\Main;
use Innmind\Http\{
    ServerRequest,
    Response,
    ServerRequest\Environment,
};
use Innmind\OperatingSystem\OperatingSystem;

new class extends Main {
    protected function preload(OperatingSystem $os, Environment $env): void
    {
        // optional, use this method to boostrap your app
    }

    protected function main(ServerRequest $request): Response
    {
        // handle the request here
    }
};