PHPackages                             stiction/safe-params - 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. stiction/safe-params

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

stiction/safe-params
====================

sanitize params

1.0.0(7y ago)123MITPHPPHP &gt;=7.1CI failing

Since Jan 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/stiction/safe-params)[ Packagist](https://packagist.org/packages/stiction/safe-params)[ RSS](/packages/stiction-safe-params/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

safe-params
===========

[](#safe-params)

sanitize params

A useful package for retrieving type-safe params

valid types:

```
int
float
bool
string
string.trim trimmed string
array
uint64 '0' ~ '18446744073709551615'
array.int
array.float
array.bool
array.string
array.string.trim
array.uint64

```

Installation
------------

[](#installation)

```
composer require stiction/safe-params
```

Examples
--------

[](#examples)

```
use Stiction\SafeParams\SafeParamsParser;

$parser = new SafeParamsParser;
$age = $parser->parse(' 29  ', 'int');

/*
int(29)
*/
var_dump($age);
```

```
use Stiction\SafeParams\SafeParamsParser;

$data = [
    'name' => '   jack   ',
    'id' => 29,
    'hobbies' => [21, 'baseball', 3.14],
    'address' => 'a beautiful village',
];
$spec = ['name' => 'string.trim', 'id' => 'uint64', 'hobbies' => 'array.int'];
$parser = new SafeParamsParser;
$safeData = $parser->parse($data, $spec);

/*
array(3) {
  ["name"]=>
  string(4) "jack"
  ["id"]=>
  string(2) "29"
  ["hobbies"]=>
  array(3) {
    [0]=>
    int(21)
    [1]=>
    int(0)
    [2]=>
    int(3)
  }
}
*/
var_dump($safeData);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Unknown

Total

1

Last Release

2678d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44c40b09f95acfe42b752c4527fc2358ee013c3908239ee21a471ab972637263?d=identicon)[stiction](/maintainers/stiction)

---

Top Contributors

[![stiction](https://avatars.githubusercontent.com/u/16113256?v=4)](https://github.com/stiction "stiction (6 commits)")

---

Tags

filterparamsphpquerysafesanitizevalidate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stiction-safe-params/health.svg)

```
[![Health](https://phpackages.com/badges/stiction-safe-params/health.svg)](https://phpackages.com/packages/stiction-safe-params)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M450](/packages/nette-forms)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)

PHPackages © 2026

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