PHPackages                             amattu2/php-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. amattu2/php-filter

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

amattu2/php-filter
==================

A basic PHP input filter and validation class.

v1.0.0(3y ago)017AGPL-3.0PHP

Since Mar 9Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Introduction
============

[](#introduction)

This is a PHP class which implements static methods to filter/format unsanitized user input. See below for usage examples and cases. Alternatively, take a look at the **index.php** file for further examples.

Usage
=====

[](#usage)

Include the **/src/Filter.php** file

```
require(dirname(__FILE__) . "/src/Filter.php");
```

**Methods**

```
Filter::*input*(string $var)
```

Remove unprintable characters, HTML entities, and slashes.

```
Filter::*nonNumeric*(int|string|double|float $var)
```

Remove non-numeric characters

```
Filter::*nonAlpha*(mixed $var)
```

Remove non-alpha (a-zA-Z) characters

```
Filter::*nonAlphaNumeric*(mixed $var)
```

Remove non-alphanumeric (a-zA-Z0-9) characters

```
Filter::*fileName*(string $var)
```

Replace whitespace characters with a dash (-)

```
Filter::*number*(int|string $var)
```

Format a 10 digit phone number (XXX-XXX-XXXX)

Notes
=====

[](#notes)

You should always use prepared statements and proper validation on all unsafe input, regardless of using this class or not.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1165d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45d27ac587ba85712309c969ca2e277df1044c60ce9f2f8a5ca69118211e30d6?d=identicon)[amattu2](/maintainers/amattu2)

---

Top Contributors

[![amattu2](https://avatars.githubusercontent.com/u/38357871?v=4)](https://github.com/amattu2 "amattu2 (7 commits)")

---

Tags

phpphp-filter

### Embed Badge

![Health badge](/badges/amattu2-php-filter/health.svg)

```
[![Health](https://phpackages.com/badges/amattu2-php-filter/health.svg)](https://phpackages.com/packages/amattu2-php-filter)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
