PHPackages                             adamthehutt/laravel-sanitized-requests - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. adamthehutt/laravel-sanitized-requests

AbandonedArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

adamthehutt/laravel-sanitized-requests
======================================

Sanitize request parameters before validation

v0.4.0(5y ago)02.3k2MITPHPPHP &gt;=7.3

Since Jun 28Pushed 5y agoCompare

[ Source](https://github.com/adamthehutt/laravel-sanitized-requests)[ Packagist](https://packagist.org/packages/adamthehutt/laravel-sanitized-requests)[ RSS](/packages/adamthehutt-laravel-sanitized-requests/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (14)Used By (2)

Laravel Sanitized Requests
--------------------------

[](#laravel-sanitized-requests)

Sanitize request input before passing to validation.

#### Installation

[](#installation)

```
composer require adamthehutt/laravel-sanitized-requests
```

#### Usage

[](#usage)

Create a Request class and use the `SanitizesInput` trait. Then implement the `sanitize(Sanitizer $sanitizer)` method to clean up user input before it is validated.

```
use AdamTheHutt\SanitizedRequests\SanitizesInput;
use AdamTheHutt\SanitizedRequests\Sanitizer;
use Illuminate\Foundation\Http\FormRequest;

class StoreItem extends FormRequest
{
    use SanitizesInput;

    public function sanitize(Sanitizer $sanitizer): void
    {
        $sanitizer->castToInt("user_id")
                  ->castToBoolean("for_sale")
                  ->castToFloat("price")
                  ->forgetIfEmpty("item_description")
                  ->trimWhitespace("nested.*.wildcard.param");
    }
}
```

#### Sanitizers

[](#sanitizers)

The following sanitize methods are currently supported:

- castToBool($key) - Casts the string input value to a boolean
- castToInt($key) - Casts the string input value to an integer
- castToFloat($key) - Casts the string input value to a float
- castToString($key) - Casts the input value to a string
- forgetIfEmpty($key) - Removes from input both empty strings and arrays with only empty values
- map($key, $callable) - Applies an arbitrary callback to the input value(s)
- trimWhitespace($key) - Trims whitespace from a string input value

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~82 days

Total

13

Last Release

2058d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57567?v=4)[Adam Huttler](/maintainers/adamthehutt)[@adamthehutt](https://github.com/adamthehutt)

---

Top Contributors

[![adamthehutt](https://avatars.githubusercontent.com/u/57567?v=4)](https://github.com/adamthehutt "adamthehutt (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adamthehutt-laravel-sanitized-requests/health.svg)

```
[![Health](https://phpackages.com/badges/adamthehutt-laravel-sanitized-requests/health.svg)](https://phpackages.com/packages/adamthehutt-laravel-sanitized-requests)
```

###  Alternatives

[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

184485.5k](/packages/illuminatech-validation-composite)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
