Skip to content

masplay/rock-sanitize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanitizator for PHP

Latest Stable Version Total Downloads Build Status HHVM Status Coverage Status License

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

Requirements

  • PHP 5.4+

License

The Rock Sanitize is open-sourced software licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages