super-simple / http-server-handler

Super Simple HTTP Server Handler 库,实现了PSR-15标准。

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

This package is auto-updated.

Last update: 2024-09-24 18:53:45 UTC


README

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

Build Status

安装

composer require super-simple/http-server-handler

需要PHP 8.1或更高版本。

使用方法

基本用法

// 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.

更多详情请查看wiki