super-simple/http-server-handler

Super Simple HTTP Server Handler library implmenting the PSR-15 standard.

v1.2 2022-07-24 11:23 UTC

This package is auto-updated.

Last update: 2024-04-24 18:03:34 UTC


README

A Super Simple HTTP Handler library implementing the PSR-15.

Build Status

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.