romeoz / rock-sanitize
Flexible sanitizator for PHP.
Installs: 18 256
Dependents: 9
Suggesters: 5
Security: 0
Stars: 47
Watchers: 11
Forks: 0
Open Issues: 1
Requires
- php: >=5.4.0
- romeoz/rock-base: 0.12.*
Requires (Dev)
- phpunit/phpunit: ^4.7.0
README
Features
- Sanitization of scalar variable, array and object
- Custom rules
- Standalone module/component for Rock Framework
Installation
From the Command Line:
composer require romeoz/rock-sanitize
In your composer.json:
{ "require": { "romeoz/rock-sanitize": "*" } }
Quick Start
use rock\sanitize\Sanitize; Sanitize::removeTags() ->lowercase() ->sanitize('<b>Hello World!</b>'); // output: hello world!
####As Array or Object
use rock\sanitize\Sanitize; $input = [ 'name' => '<b>Tom</b>', '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
Demo
- Install Docker or askubuntu
docker run --name demo -d -p 8080:80 romeoz/docker-rock-sanitize
- Open demo http://localhost:8080/
Requirements
- PHP 5.4+
License
The Rock Sanitize is open-sourced software licensed under the MIT license.