PHP code example of innmind / http-server

1. Go to this page and download the library: Download innmind/http-server library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

innmind / http-server example snippets




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
    }
};