1.0.0 2023-03-21 08:59 UTC

This package is auto-updated.

Last update: 2024-04-25 12:45:49 UTC


Build Status Latest Version on Packagist Software License

This package provides a psr-15 implementation with helpers


PHP 8.2 or higher.


composer require stefna/http-runner

Getting started


use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Stefna\Http\Middleware\ContainerMiddlewareResolver;
use Stefna\Http\Middleware\NullMiddlewareResolver;
use Stefna\Http\Middleware\Runner;
use Stefna\Http\Middleware\SimpleMiddlewarePipeline;
use Stefna\Http\Request\ServerRequestMarshal;
use Stefna\Http\ResponseHandler\HttpResponseHandler;

/** @var ContainerInterface $container */
/** @var ResponseFactoryInterface $responseFactory */

$middlewares = new SimpleMiddlewarePipeline(
	new CrashMiddleware(),
	new SessionMiddleware(),
	new RouterMiddleware(),
	new RouteDispatchMiddleware(),

// no resolving of middlewares all middlewares need to be instantiated earlier
$middlewareResolver = new NullMiddlewareResolver();
// or if middleware is a string look in container for it and lazy create it when needed
$middlewareResolver = new ContainerMiddlewareResolver($container);

$runner = new Runner(

// boot request
/** @var ServerRequestInterface $request */
$request = (new ServerRequestMarshal())->marshal($_SERVER);

// dispatch middlewares and get a response back
$response = $runner->handle($request);

// send response
(new HttpResponseHandler())->handle($response);


We are always happy to receive bug/security reports and bug/security fixes


The MIT License (MIT). Please see License File for more information.