michael-rubel/laravel-safe-request
A Laravel package for safer request handling: define validation rules and access only validated input, keeping unvalidated fields out of controllers and services. It helps reduce mass-assignment and untrusted-data risks while keeping form requests simple.
FormRequest objects, so controllers and services can't accidentally reach for raw, unvalidated request data. As a PM, this is not a feature decision — it's a risk-reduction decision you can point to when asked "how do we prevent validation bypasses and mass-assignment bugs?"FormRequest (or adopt Laravel's first-party equivalent) rather than take a dependency. The 2.0.1 release does not change the sizing of that work — it's still roughly a day of engineering to own the behavior internally.$request->input() usage.Consider the pattern (not necessarily the package) when:
$request->validated()['field'] calls, or mixes $request->input() with validated data in the same flow.FormRequest already — adding a validated-only accessor is a few lines and zero ongoing maintenance.Look elsewhere (i.e., do not adopt as a dependency) when:
$request->foo means is a real cost; explicit validated() is clearer and self-documenting.sometimes rules. A one-trait package with no test/issue signal is the wrong place to discover edge cases, and a patch release adding framework support does not change that.To executives: A small, low-risk engineering pattern, not a product investment. It prevents a class of bugs where unvalidated user input leaks into business logic — the kind of thing that shows up as a security finding in an audit. We still do not recommend taking the dependency: it's a single-maintainer micro-package with one compatibility-driven release and no production dependents. The recent 2.0.1 update (Laravel 10 support) is a mildly positive maintenance signal, but it doesn't give us a support commitment, a security-response path, or an upgrade guarantee for future Laravel versions. Instead we'll implement the equivalent in roughly a day of engineering inside our own base request class, which we control and can patch. Recommendation unchanged: steal the pattern, skip the dependency.
To engineering: The idea is sound and worth stealing — make FormRequest return validated data by default instead of raw input, so the safe path is the easy path. Release 2.0.1 is a patch that adds Laravel 10 support only: no new API, no breaking changes, no deprecations, no security-relevant changes. It narrows the compatibility gap but doesn't change the architecture call — the package is a single trait, largely superseded by first-party validated-input access in current Laravel. Recommendation stands: don't add the dependency; fold the behavior into our base FormRequest (or a small SafeRequest concern) with tests, and pair it with a lint/PR rule banning $request->input() in controllers that already have a FormRequest. If we do end up vendoring the trait rather than reimplementing it, note the MIT license and the single-maintainer bus factor in the PR description. Net cost: low. Net benefit: fewer validation-bypass defects and a clearer HTTP-to-domain contract.
How can I help you explore Laravel packages today?