adamnbowen/sanitize

Sanitizes arbitrary objects and arrays.


Keywords
proxy, sanitize
License
Other

Documentation

Sanitize

Build Status

Sanitizes arbitrary objects and arrays, and provides an object interface for accessing the sanitized objects and arrays.

Usage

<?php
use Sanitize\Sanitize;

$sanitized = Sanitize::clean($_POST);
$sanitized->foo; // == a sanitized $_POST['foo'] OR null

Installation

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.

Coding Standards

Use the following coding standards in order:

  1. PSR-0 Autoloading Standard
  2. PSR-1 Basic Coding Standard
  3. PSR-2 Coding Style Guide
  4. Zend Framework Coding Standard for PHP
  5. PEAR Coding Standards

TODO

  • Test injection of objects into Sanitize
  • Test __PHP_Incomplete_Class fix

Changelog

  • 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.