lextira / laravel-formrequest-singleton
Use Laravel's excellent FormRequest as Singleton.
Package info
github.com/lextira/laravel-formrequest-singleton
pkg:composer/lextira/laravel-formrequest-singleton
v1.1.0
2026-03-25 12:59 UTC
Requires
- php: ^7.0|^8.0|^8.1|^8.2|^8.3|^8.4|^8.5
- laravel/framework: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
This package is auto-updated.
Last update: 2026-03-25 13:00:28 UTC
README
Use Laravel's excellent FormRequest as Scoped
Installation
- run
composer require lextira/laravel-formrequest-singleton - open
config/app.phpin your project - replace
Illuminate\Foundation\Providers\FoundationServiceProvider::class
withLextira\FormRequestSingleton\FoundationServiceProvider::class - done!
Usage
All classes, which extend Illuminate\Foundation\Http\FormRequest are now instantiated as scoped.
This brings the following benefits:
- Changes done to the request by
prepareForValidation()are applied only once, even if the FormRequest is used multiple times. - The request validation is run only once, therefore especially database queries run only once.