PHPackages                             traderinteractive/filter-ints - 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. traderinteractive/filter-ints

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

traderinteractive/filter-ints
=============================

A filtering implementation for verifying correct data and performing typical modifications to data

v4.0.0(3y ago)1102.5k↓46.8%12MITPHPPHP ^7.3 || ^8.0CI failing

Since Mar 7Pushed 2y ago7 watchersCompare

[ Source](https://github.com/traderinteractive/filter-ints-php)[ Packagist](https://packagist.org/packages/traderinteractive/filter-ints)[ RSS](/packages/traderinteractive-filter-ints/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (2)

filter-ints-php
===============

[](#filter-ints-php)

[![Build Status](https://camo.githubusercontent.com/84a451a2e2c1a82806c277cedac1e15e6f0536a2e92429ef05e03274c9d879b1/68747470733a2f2f7472617669732d63692e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/traderinteractive/filter-ints-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/064d6be17f534abbe598c7371d7f6bcbe2852a357b734684f39e513bb5049ca4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747261646572696e7465726163746976652f66696c7465722d696e74732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/traderinteractive/filter-ints-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/71999d93a7cf9abf364fcab2211713dce5b4c56795cc4d1f795b0b7a946b1ab1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747261646572696e7465726163746976652f66696c7465722d696e74732d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/traderinteractive/filter-ints-php?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/242ab9fea3369780c94d9079a73364488137095c393a60c395651f1a34ce1aea/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f762f737461626c65)](https://packagist.org/packages/traderinteractive/filter-ints)[![Latest Unstable Version](https://camo.githubusercontent.com/a8a4ae464303af4653ec1ca0d5ca706ecff937aa1753269950bb1c5c5548c6af/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f762f756e737461626c65)](https://packagist.org/packages/traderinteractive/filter-ints)[![License](https://camo.githubusercontent.com/61e89200075d25ee5adabbc13229e6ea052eb83fa21b8290ab43dd28aa75c338/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f6c6963656e7365)](https://packagist.org/packages/traderinteractive/filter-ints)

[![Total Downloads](https://camo.githubusercontent.com/3902c1e4fdd90a48f5a031e7b9ace76ee10c1663e2742fffabd5951c93f4b131/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f646f776e6c6f616473)](https://packagist.org/packages/traderinteractive/filter-ints)[![Daily Downloads](https://camo.githubusercontent.com/3608b29e81785936ec3ae02594110aa95541d4ce6a78a1fb6b56838582b56823/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f642f6461696c79)](https://packagist.org/packages/traderinteractive/filter-ints)[![Monthly Downloads](https://camo.githubusercontent.com/8917b149b485ab949f1aa4e0e849fe9752b8fdc847d237dafe884089bc2fafdd/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d696e74732f642f6d6f6e74686c79)](https://packagist.org/packages/traderinteractive/filter-ints)

A filtering implementation for verifying correct data and performing typical modifications to data.

Requirements
------------

[](#requirements)

Requires PHP 7.0 or newer and uses composer to install further PHP dependencies. See the [composer specification](composer.json) for more details.

Composer
--------

[](#composer)

To add the library as a local, per-project dependency use [Composer](http://getcomposer.org)! Simply add a dependency on `traderinteractive/filter-ints` to your project's `composer.json` file such as:

```
composer require traderinteractive/filter-ints
```

### Functionality

[](#functionality)

#### Ints/UnsignedInt::filter

[](#intsunsignedintfilter)

These filters verify that the arguments are of the proper numeric type and allow for bounds checking. The second parameter to each of them can be set to `true` to allow null values through without an error (they will stay null and not get converted to false). The next two parameters are the min and max bounds and can be used to limit the domain of allowed numbers.

Non-numeric strings will fail validation, and numeric strings will be cast.

The following checks that `$value` is an integer between 1 and 100 inclusive, and returns the integer (after casting it if it was a string).

```
$value = \TraderInteractive\Filter\UnsignedInt::filter($value, false, 1, 100);
```

Contact
-------

[](#contact)

Developers may be contacted at:

- [Pull Requests](https://github.com/traderinteractive/filter-ints-php/pulls)
- [Issues](https://github.com/traderinteractive/filter-ints-php/issues)

Project Build
-------------

[](#project-build)

With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run:

```
composer install
./vendor/bin/phpcs
./vendor/bin/phpunit
```

For more information on our build process, read through out our [Contribution Guidelines](CONTRIBUTING.md).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% 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

Every ~1665 days

Total

2

Last Release

1376d ago

Major Versions

v3.0.0 → v4.0.02022-09-27

PHP version history (2 changes)v3.0.0PHP ^7.0

v4.0.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29952359?v=4)[Trader Interactive](/maintainers/traderinteractive)[@traderinteractive](https://github.com/traderinteractive)

---

Top Contributors

[![chrisryan](https://avatars.githubusercontent.com/u/704326?v=4)](https://github.com/chrisryan "chrisryan (5 commits)")[![chadicus](https://avatars.githubusercontent.com/u/1182337?v=4)](https://github.com/chadicus "chadicus (3 commits)")

---

Tags

integerintunsigneduintints

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/traderinteractive-filter-ints/health.svg)

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

###  Alternatives

[nelexa/buffer

Reading And Writing Binary Data (incl. primitive types, ex. byte, ubyte, short, ushort, int, uint, long, float, double). The classes also help with porting the I/O operations of the JAVA code.

33527.5k5](/packages/nelexa-buffer)[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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