brayniverse / prosaic

A boring PSR-15 middleware dispatcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prosaic

A boring PSR-15 Middleware dispatcher

Prosaic can run your incoming PSR-7 requests through a pipeline of PSR-15 middleware. There's no fancy builder methods, routing or DI container integration, it's really just a pipeline of middleware. That's it.

Installation

composer require rosstuck/prosaic

Example

You can set up your middleware pipeline like so:

<?php

$dispatcher = new Prosaic\HttpDispatcher(
    new FirstMiddleware(),
    new SecondMiddleware(),
    new ThirdMiddleware()
);

$response = $dispatcher->dispatch($request);

Testing

./vendor/bin/phpunit
./vendor/bin/phpstan analyse --level=max src tests
./vendor/bin/phpcs --standard=doctrine src tests

About

A boring PSR-15 middleware dispatcher


Languages

Language:PHP 100.0%