PHPackages                             dealnews/filter - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. dealnews/filter

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

dealnews/filter
===============

This class is a drop in replacement and wrapper for filter\_var, filter\_var\_array, filter\_input, and filter\_input\_array. The only filters that are modified are ones using \\DealNews\\Filter\\Filter::FILTER\_SANITIZE\_STRING.

2.0.0(8mo ago)04.2k↓22%1BSD-3-ClausePHPPHP ^8.2CI passing

Since Mar 15Pushed 8mo ago3 watchersCompare

[ Source](https://github.com/dealnews/filter)[ Packagist](https://packagist.org/packages/dealnews/filter)[ RSS](/packages/dealnews-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (11)Used By (1)

DealNews\\Filter
================

[](#dealnewsfilter)

Starting with PHP 8.1, the filter type FILTER\_SANITIZE\_STRING was deprecated. To avoid deprecated errors, this class implements similar behavior as the FILTER\_SANITIZE\_STRING filter. This is done by changing filters using `\DealNews\Filter\Filter::FILTER_SANITIZE_STRING` to use `FILTER_CALLBACK` to a closure implementing behavior similar to what `\FILTER_SANITIZE_STRING` provides.

This class is a drop in replacement for `filter_var`, `filter_var_array`, `filter_input`, and `filter_input_array`. The only filter that is is modified are ones using `\DealNews\Filter\Filter::FILTER_SANITIZE_STRING`.

Example
-------

[](#example)

### PHP &lt;= 8.0

[](#php--80)

This is how you used `FILTER_SANITIZE_STRING` in PHP &lt;=8.0.

```
