daft-framework / daft-psr-router
PSR-based variant of signpostmarv/daft-router
v0.4.0
2022-06-18 16:09 UTC
Requires
- php: ^7.4|^8.0
- ext-mbstring: *
- nikic/fast-route: ^1.3
- psr/http-message: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- signpostmarv/daft-interface-collector: ^2.6
Requires (Dev)
- infection/infection: ^0.26.11
- maglnet/composer-require-checker: ^3.3
- php-coveralls/php-coveralls: ^2.5
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17.0
- roave/security-advisories: dev-latest
- sebastian/phpcpd: ^6.0
- signpostmarv/php-cs-fixer-config: ^0.23.0
- vimeo/psalm: ^4.23
Suggests
- vimeo/psalm: Useful for static analysis to reduce runtime type checks etc.
Conflicts
- vimeo/psalm: <4.8.1
README
Copyright 2020 SignpostMarv
daft-psr-router
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 ofFastRoute\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.