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)12.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 today

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 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

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

2152d 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.3M27](/packages/yajra-laravel-oci8)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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