PHPackages                             broeser/sanitor - 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. [Search &amp; Filtering](/categories/search)
4. /
5. broeser/sanitor

ActiveLibrary[Search &amp; Filtering](/categories/search)

broeser/sanitor
===============

Sanitor is a thin wrapper around PHPs sanitization functions filter\_var, filter\_input and filter\_has\_var

1.1.1(10y ago)0179MITPHPPHP &gt;=5.4.0

Since Jan 22Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (5)Used By (0)

[![Sanitor](https://camo.githubusercontent.com/09e88fd9c5db0fc7a8d7bc94ffe888b62a0c1315fb71758c54f28c93c3499649/687474703a2f2f62726f657365722e6769746875622e696f2f73616e69746f722f696d616765732f73616e69746f722d6c6f676f2e737667)](https://camo.githubusercontent.com/09e88fd9c5db0fc7a8d7bc94ffe888b62a0c1315fb71758c54f28c93c3499649/687474703a2f2f62726f657365722e6769746875622e696f2f73616e69746f722f696d616765732f73616e69746f722d6c6f676f2e737667)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

Sanitor is a thin wrapper around PHP's sanitization functions filter\_var, filter\_input and filter\_has\_var.

[![Build Status](https://camo.githubusercontent.com/8d7e0ccdfc214fe6213f6918963e6cd5a772f7206600d1e369b128c4603e178b/68747470733a2f2f7472617669732d63692e6f72672f62726f657365722f73616e69746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/broeser/sanitor)[![codecov.io](https://camo.githubusercontent.com/bafee738c1f814e6e9baf75570ec85156fe61857f5172568742354d54d96aa20/68747470733a2f2f636f6465636f762e696f2f6769746875622f62726f657365722f73616e69746f722f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/broeser/sanitor?branch=master)[![License](https://camo.githubusercontent.com/e498eead712d82d9ee1af0a4850acd2e46ea48c48fb9ce5a3d2ab64f28f95b34/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](http://mit-license.org)[![SemVer 2.0.0](https://camo.githubusercontent.com/80a092585308866a22318249288bb79a8841799ea528d3dacfc53bdfb8e23ecf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656d7665722d322e302e302d626c75652e737667)](http://semver.org/spec/v2.0.0.html)

Latest stable version: 1.1.1

Why?
----

[](#why)

- PHP's filter extension is a bit buggy, INPUT\_ENV does not work properly, Sanitor can handle it
- PHP's filter extension currently does not support INPUT\_SESSION and INPUT\_REQUEST, Sanitor does
- PHP's filter extension does not offer object oriented syntax, Sanitor does
- You can build sanitizable data objects with Sanitor

Goals
-----

[](#goals)

- Sanitor should be easy to use and easy to learn
- Sanitor should never implement its own fancy filters but just expose PHP's built-in filters in OOP-style

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

[](#installation)

Sanitor works with PHP 5.4, 5.5., 5.6 and 7.0.

The package can be installed via composer:

`composer require broeser/sanitor`

How to use
----------

[](#how-to-use)

**IMPORTANT:** Sanitor does only sanitization – never try to use it as a validation filter. It will not work as expected.

### Basic usage *with filter(), filterGet(), filterPost(), filterRequest(), filterCookie() etc.*

[](#basic-usage-with-filter-filterget-filterpost-filterrequest-filtercookie-etc)

```
