PHPackages                             traderinteractive/filter-floats - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. traderinteractive/filter-floats

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

traderinteractive/filter-floats
===============================

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

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

Since Mar 6Pushed 2y ago7 watchersCompare

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

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

TraderInteractive Filter\\Floats
================================

[](#traderinteractive-filterfloats)

[![Build Status](https://camo.githubusercontent.com/5e1374d194dd2e4d65f2720aa39594d632134d1e0ad1359e0377a2ab4859f709/68747470733a2f2f7472617669732d63692e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/traderinteractive/filter-floats-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/79f04edda684e64bc420aed7da899a30f7392c4bc9b356653e86805c26a0db73/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/traderinteractive/filter-floats-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/de3cbf3653e87f1d129254c0f5abc67c807f2e018d03dcdb35da491a18041502/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747261646572696e7465726163746976652f66696c7465722d666c6f6174732d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/traderinteractive/filter-floats-php?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/a8564f47e2bf211b2868f318f3835211e3ff75bf28cd2bd7b67fa4dcbf99b9e0/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f762f737461626c65)](https://packagist.org/packages/traderinteractive/filter-floats)[![Latest Unstable Version](https://camo.githubusercontent.com/02888762b7c684e083d7b32519c16e785e5ce74682d8df58c2ba2d3ff3abfa35/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f762f756e737461626c65)](https://packagist.org/packages/traderinteractive/filter-floats)[![License](https://camo.githubusercontent.com/80e36e6254eba6618c810649d8daf85d19acd8132295d33fde15d35c6a6846cc/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f6c6963656e7365)](https://packagist.org/packages/traderinteractive/filter-floats)

[![Total Downloads](https://camo.githubusercontent.com/bf8392c369677e145a956408e28befc1120fe2cd8d0e7fe69514887bfb20570d/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f646f776e6c6f616473)](https://packagist.org/packages/traderinteractive/filter-floats)[![Daily Downloads](https://camo.githubusercontent.com/d4699028f514c4dc9112478f4dc737f47c5602ee14d65d44423b00d6bf679cfb/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f642f6461696c79)](https://packagist.org/packages/traderinteractive/filter-floats)[![Monthly Downloads](https://camo.githubusercontent.com/2ad4c87128dbe0223680b2fabff58966901ed15dc92232e28a4b689009e2e7c1/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d666c6f6174732f642f6d6f6e74686c79)](https://packagist.org/packages/traderinteractive/filter-floats)

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

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.

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

[](#installation)

filter-floats-php can be installed for use in your project using [composer](http://getcomposer.org). The recommended way of using this library in your project is to add a `composer.json` file to your project. The following contents would add filter-floats-php as a dependency:

```
composer require traderinteractive/filter-floats
```

Included Filters
----------------

[](#included-filters)

### Floats::filter

[](#floatsfilter)

This filter verifies that the arguments are of the proper numeric type and allow for bounds checking. The second parameter 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.

The final parameter can be set to true to cast integers to floats. Without this, integers will fail validation.

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

The following checks that $value is a float between 1.0 and 100.00 inclusive, and returns the float (after casting it if it was a string or integer).

```
$value = \TraderInteractive\Filter\Floats::filter($value, false, 1.0, 100.00, true);
```

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

[](#project-build)

With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run: ``sh composer install ./vendor/bin/phpunit ./vendor/bin/phpcs

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

```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

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

1375d 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

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

---

Tags

utilityfilterfloat

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k430.4M1.7k](/packages/nette-utils)[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.3M192](/packages/danielstjules-stringy)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4915.7M18](/packages/voku-arrayy)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

3014.6M26](/packages/vaimo-composer-patches)[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3291.6M3](/packages/snipe-banbuilder)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6340.1M95](/packages/phpcsstandards-phpcsutils)

PHPackages © 2026

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