PHPackages                             romeoz/rock-sanitize - 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. romeoz/rock-sanitize

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

romeoz/rock-sanitize
====================

Flexible sanitizator for PHP.

0.11.1(10y ago)4720.1k↑42.9%[1 issues](https://github.com/romeOz/rock-sanitize/issues)9MITPHPPHP &gt;=5.4.0

Since Oct 29Pushed 10y ago9 watchersCompare

[ Source](https://github.com/romeOz/rock-sanitize)[ Packagist](https://packagist.org/packages/romeoz/rock-sanitize)[ RSS](/packages/romeoz-rock-sanitize/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (9)

Sanitizator for PHP
===================

[](#sanitizator-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/a486a4e406e662ca1a682e14e65796dad0a17f710bb6591751f07168ea5b3f4f/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d73616e6974697a652f762f737461626c652e737667)](https://packagist.org/packages/romeOz/rock-sanitize)[![Total Downloads](https://camo.githubusercontent.com/fbf422eec099f4713c3e4a287af95853e184351415a334c65fc8c97696ad82cf/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d73616e6974697a652f646f776e6c6f6164732e737667)](https://packagist.org/packages/romeOz/rock-sanitize)[![Build Status](https://camo.githubusercontent.com/89071bb25a81e52da6a219d55e6a18924d5b1cee9fdf1ac4ab65b3de9182c738/68747470733a2f2f7472617669732d63692e6f72672f726f6d654f7a2f726f636b2d73616e6974697a652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/romeOz/rock-sanitize)[![HHVM Status](https://camo.githubusercontent.com/15bd9816fa42b918217dd2471c6430314b221816b8928e5bb746c2b8f99a31cc/687474703a2f2f6868766d2e683463632e64652f62616467652f726f6d656f7a2f726f636b2d73616e6974697a652e737667)](http://hhvm.h4cc.de/package/romeoz/rock-sanitize)[![Coverage Status](https://camo.githubusercontent.com/07a89bc6f57d0c22e95329a5a196abd99cffd451cc0cda53838ce8b47e04b326/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f726f6d654f7a2f726f636b2d73616e6974697a652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/romeOz/rock-sanitize?branch=master)[![License](https://camo.githubusercontent.com/545c48227d73f14316ea9123a48cbddc83e43e827fce45f7b307a1c72b8b34ca/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d73616e6974697a652f6c6963656e73652e737667)](https://packagist.org/packages/romeOz/rock-sanitize)

Features
--------

[](#features)

- Sanitization of scalar variable, array and object
- Custom rules
- Standalone module/component for [Rock Framework](https://github.com/romeOz/rock)

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

[](#installation)

From the Command Line:

```
composer require romeoz/rock-sanitize

```

In your composer.json:

```
{
    "require": {
        "romeoz/rock-sanitize": "*"
    }
}
```

Quick Start
-----------

[](#quick-start)

```
use rock\sanitize\Sanitize;

Sanitize::removeTags()
    ->lowercase()
    ->sanitize('Hello World!');
// output: hello world!
```

\####As Array or Object

```
use rock\sanitize\Sanitize;

$input = [
    'name' => 'Tom',
    'age' => -22
];

$attributes = [
    'name' => Sanitize::removeTags(),
    'age' => Sanitize::abs()
];

Sanitize::attributes($attributes)->sanitize($input);
/*
output:

[
  'name' => 'Tom',
  'age' => 22
]
*/

// all attributes:
Sanitize::attributes(Sanitize::removeTags())->sanitize($input);
```

Documentation
-------------

[](#documentation)

- [Rules](https://github.com/romeOz/rock-sanitize/blob/master/docs/rules.md)
- [Custom rules](https://github.com/romeOz/rock-sanitize/blob/master/docs/custom-rules.md)

[Demo](https://github.com/romeOz/docker-rock-sanitize)
------------------------------------------------------

[](#demo)

- [Install Docker](https://docs.docker.com/installation/) or [askubuntu](http://askubuntu.com/a/473720)
- `docker run --name demo -d -p 8080:80 romeoz/docker-rock-sanitize`
- Open demo

Requirements
------------

[](#requirements)

- PHP 5.4+

License
-------

[](#license)

The Rock Sanitize is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity56

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 ~28 days

Recently: every ~39 days

Total

14

Last Release

3846d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23c5d84a59845d751cb69f5469986579b9312c54c898b366fefdc05baaa80a9c?d=identicon)[romeOz](/maintainers/romeOz)

---

Top Contributors

[![romeOz](https://avatars.githubusercontent.com/u/3135712?v=4)](https://github.com/romeOz "romeOz (79 commits)")

---

Tags

sanitizesanitizationsanitizator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/romeoz-rock-sanitize/health.svg)

```
[![Health](https://phpackages.com/badges/romeoz-rock-sanitize/health.svg)](https://phpackages.com/packages/romeoz-rock-sanitize)
```

###  Alternatives

[siriusphp/validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

181743.3k13](/packages/siriusphp-validation)[abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP &gt;= 8.1.

312.0M2](/packages/abcaeffchen-sepa-utilities)[surgiie/transformer

A data transforming/formatting package for php.

12724.3k1](/packages/surgiie-transformer)[progsmile/request-validator

Simple PHP Request Validator

33113.3k1](/packages/progsmile-request-validator)[mathiasreker/php-svg-optimizer

php-svg-optimizer is a PHP library designed to optimize SVG files by applying various transformations and cleanup operations.

338.9k2](/packages/mathiasreker-php-svg-optimizer)[ondrej-vrto/php-filename-sanitize

Removes all forbidden characters from the file name or path.

1120.6k1](/packages/ondrej-vrto-php-filename-sanitize)

PHPackages © 2026

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