What problem does it solve?
Form Request Validation centralizes input validation away from controllers, preventing validation logic from scattering across actions and improving security and maintainability.
Core Features & Use Cases
- Dedicated Form Requests live under app/Http/Requests and group validation by domain (e.g., Auth, Invoices).
- Methods authorize(), rules(), and messages() provide clear access control and user-friendly errors, with PHPDoc annotations for static analysis.
- Automatic validation: Laravel applies the FormRequest before the controller action, returning validation errors when needed.
- Use Case: When creating or updating resources, replace inline validation with a dedicated request class to enforce consistent rules.
Quick Start
Create a Form Request class for the target resource, inject it into the controller method, and trigger the request to validate input automatically.