daft-framework/daft-psr-router

PSR-based variant of signpostmarv/daft-router

v0.4.0 2022-06-18 16:09 UTC

This package is auto-updated.

Last update: 2024-10-18 21:19:09 UTC


README

Copyright 2020 SignpostMarv

daft-psr-router

Coverage Status Build Status Type Coverage

Finally got around to creating a psr-based router. Because reasons.

Adapts signpostmarv/daft-router patterns to work with PSR-7, PSR-15, etc.

differences between daft-router & daft-psr-router

nikic/fast-route

  • the custom RouteCollector (which served only to provide type hinting) was dropped.
  • the route compiler was simplified, with the instantiation + manipulation methods being dropped.
  • the requirement for using FastRoute\cachedDispatcher was dropped, although it's use is still recommended
  • the custom dispatcher was dropped in favour of a final static method that accepts any FastRoute\Dispatcher instance, strictly checks the result of FastRoute\Dispatcher::dispatch(), and returns an object representing the return value.

psr-15

  • daft-router's request interceptors were retained by adding a specific Psr\Http\Message\ResponseInterface instance.