worksome / phpstan-request-factories
A PHPStan rule for enforcing that every request has a corresponding factory.
Fund package maintenance!
worksome
Installs: 105 716
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- illuminate/contracts: ^10.0 || ^11.0
- illuminate/http: ^10.0 || ^11.0
- phpstan/phpstan: ^2.0
- worksome/request-factories: ^3.2
Requires (Dev)
- larastan/larastan: ^3.0
- nunomaduro/collision: ^7.10 || ^8.1
- orchestra/testbench: ^8.5.8 || ^9.0
- pestphp/pest: ^2.33
- worksome/coding-style: ^3.0
This package is auto-updated.
Last update: 2024-12-12 12:29:05 UTC
README
A PHPStan rule for enforcing that every request has a corresponding factory.
Installation
You can install the package via composer:
composer require --dev worksome/phpstan-request-factories
If you have also installed phpstan/extension-installer
then everything will work out of the box.
Manual installation
If you don't want to use phpstan/extension-installer
, include extension.neon
in your project's PHPStan config:
includes:
- vendor/worksome/phpstan-request-factories/extension.neon
Usage
Choosing different namespaces
The request and factory namespaces are both configurable. They can be configured using the following parameters:
requestFactories.requestsNamespace
(default isApp\\Http\\Requests
)requestFactories.factoriesNamespace
(default isTests\\RequestFactories
)
For example:
parameters: requestFactories: requestsNamespace: App\Http\Requests factoriesNamespace: Tests\RequestFactories
Excluding request classes
If there are certain request classes that you want to exclude, you can exclude these using
the excludedRequestClasses
parameter.
For example:
parameters: requestFactories: excludedRequestClasses: - App\Http\Requests\IgnorableRequest
Testing
composer test
Changelog
Please see GitHub Releases for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.