super-simple / http-server-handler
Super Simple HTTP Server Handler library implmenting the PSR-15 standard.
v1.2
2022-07-24 11:23 UTC
Requires
- php: >=8.1
- psr/http-server-handler: ^1.0.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- phpunit/phpunit: >=9.0
README
A Super Simple HTTP Handler library implementing the PSR-15.
Install
composer require super-simple/http-server-handler
Requires PHP 8.1 or newer.
Usage
Basic usage:
// Create a handler, the $defaultResponse must implement Psr\Http\Message\ResponseInterface. $handler = new HTTPServerHandler($defaultResponse); // Handle the request $response = $handler->handle($request);
It's possible to add Middlewares.
//.... create a handler // The $middleware must implement Psr\Http\Server\MiddlewareInterface $handler->addMiddleware($middlware); // ... handle the request.
For more details check out the wiki.