psr/http-server-middleware
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
psr/http-server-handler | 1.0.2 | 2.65 kB | MIT | prod |
The PHP package psr/http-server-middleware provides a common interface for server-side HTTP middleware, according to PSR-15 (HTTP Server Request Handlers). This package itself is not a middleware implementation, but rather it describes what an HTTP server middleware should look like.
Utilizing the psr/http-server-middleware requires understanding of PSR-15 standards and PHP programming. As an interface, it may be used to define the structure for your middleware classes. While the package's readme doesn't provide a specific example, a general usage may look like this:
class YourMiddleware implements Psr\Http\Server\MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Your middleware logic here
return $handler->handle($request);
}
}
In the above code, YourMiddleware
class is implementing the MiddlewareInterface
, abiding by the rules defined by PSR-15. The process(...)
function is where the logic of your middleware would reside.