Sanitizes arbitrary objects and arrays, and provides an object interface for accessing the sanitized objects and arrays.
<?php
use Sanitize\Sanitize;
$sanitized = Sanitize::clean($_POST);
$sanitized->foo; // == a sanitized $_POST['foo'] OR null
Install via Composer, by first adding the following in your composer.json
file:
{
"require": {
"adamnbowen/sanitize": "0.3.*"
}
}
Then run php composer.phar install
in your terminal to download and install Sanitize. Make sure to require the vendor/autoload.php
generated by Composer, and you should be good to go.
Use the following coding standards in order:
- PSR-0 Autoloading Standard
- PSR-1 Basic Coding Standard
- PSR-2 Coding Style Guide
- Zend Framework Coding Standard for PHP
- PEAR Coding Standards
- Test injection of objects into Sanitize
- Test __PHP_Incomplete_Class fix
- Sanitize::Clean() is now Sanitize::clean()
- Filtered has been renamed to Proxy()
- Proxy is now iterable, so you can foreach over sanitized objects/arrays
- !empty() is no longer called on values—Sanitized objects will retain values of
false
,0
, etc.