worksome/phpstan-request-factories

A PHPStan rule for enforcing that every request has a corresponding factory.
260,782 1
Install
composer require worksome/phpstan-request-factories
Latest Version:v2.2.0
PHP:^8.4
Laravel:12 · 13
Older releases:10 · 11
License:MIT
Last Updated:Apr 13, 2026
Links: GitHub  ·  Packagist
Maintainer: owenvoke

PHPStan Request Factories

Latest Version on Packagist GitHub Tests Action Status GitHub Static Analysis Action Status Total Downloads

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.

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 is App\\Http\\Requests)
  • requestFactories.factoriesNamespace (default is Tests\\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.

Related Packages

worksome/envy

Automatically keep your .env files in sync.

2,075,809 688
worksome/exchange

Check Exchange Rates for any currency in Laravel.

681,882 126
worksome/company-info

Lookup company information

522,301 34
worksome/request-factories

Test Form Requests in Laravel without all of the boilerplate.

2,340,626 622
worksome/verify-by-phone

Verify your users by call or SMS

661,040 147

Version History

Version Released PHP Laravel License
v2.2.0 ^8.4 ^12.0 || ^13.0 MIT
v2.1.0 ^8.2 ^10.0 || ^11.0 || ^12.0 MIT
v2.0.0 ^8.2 ^10.0 || ^11.0 MIT
v1.1.0 ^8.2 ^10.0 || ^11.0 MIT
v1.0.1 ^8.2 ^10.0 MIT