yiisoft / request-provider
PSR-7 request provider
Fund package maintenance!
Opencollective
yiisoft
Installs: 3 199
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 13
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- psr/http-message: ^1.0|^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- maglnet/composer-require-checker: ^4.7
- phpunit/phpunit: ^10.5
- rector/rector: ^1.0.1
- roave/infection-static-analysis-plugin: ^1.34
- spatie/phpunit-watcher: ^1.23
- vimeo/psalm: ^5.20
- yiisoft/di: ^1.2
This package is auto-updated.
Last update: 2024-04-04 16:44:21 UTC
README
Yii Request Provider
The package provides current PSR-7 request as a dependency.
Requirements
- PHP 8.1 or higher.
Installation
The package could be installed with composer:
composer require yiisoft/request-provider
General usage
First, add Yiisoft\RequestProvider\RequestCatcherMiddleware
to your application middleware stack.
Then, when you need current request, get RequestProviderInterface
as dependency and obtain the request from it:
use Yiisoft\RequestProvider\RequestProviderInterface; final class MyService { public function __construct( private readonly RequestProviderInterface $requestProvider ) { } public function doIt() { $request = $this->requestProvider->get(); // ... } }
Testing
Unit testing
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
Mutation testing
The package tests are checked with Infection mutation framework with Infection Static Analysis Plugin. To run it:
./vendor/bin/roave-infection-static-analysis-plugin
Static analysis
The code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalm
Code style
Use Rector to make codebase follow some specific rules or use either newest or any specific version of PHP:
./vendor/bin/rector
Dependencies
Use ComposerRequireChecker to detect transitive Composer dependencies.
License
The Yii request-provider is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.