PHP code example of super-simple / http-server-handler
1. Go to this page and download the library: Download super-simple/http-server-handler 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/ */
super-simple / http-server-handler example snippets
// Create a handler, the $defaultResponse must implement Psr\Http\Message\ResponseInterface.
$handler = new HTTPServerHandler($defaultResponse);
// Handle the request
$response = $handler->handle($request);
//.... create a handler
// The $middleware must implement Psr\Http\Server\MiddlewareInterface
$handler->addMiddleware($middlware);
// ... handle the request.