PHPackages                             ft/predicates - 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. ft/predicates

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

ft/predicates
=============

A simple, lightweight, dependency free PHP library for predicates and callbacks for dates, strings, numbers, versions etc

1.0.1(3y ago)125MITPHPPHP &gt;=8.1

Since Feb 13Pushed 3y ago2 watchersCompare

[ Source](https://github.com/soulshined/ft-predicates)[ Packagist](https://packagist.org/packages/ft/predicates)[ GitHub Sponsors](https://github.com/soulshined)[ RSS](/packages/ft-predicates/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

A simple, lightweight, dependency free PHP library for predicates and callbacks for dates, strings, numbers, versions etc

Features
--------

[](#features)

- Suite of predicates
- Convienence callbacks for things like easier array filtering
- No namespace means no worrying about use statements and qualifying function names
- Deprecation notices for when/if php adds a new function by the same name
- Built-in locale awareness (internationalization) for most predicates
- Predicate Categories
    - General Use
    - Dates
    - Numbers
    - Strings
    - PHP (versions)
    - Platform
    - Server
    - Callbacks

Usage
-----

[](#usage)

- Ensure to have intl extension enabled in your php.ini
- `> composer require ft/predicates`

Examples
--------

[](#examples)

```
$array = [null,0,1,2,3,4,5,'one','two'];

array_filter($array, 'is_positive'); // [1,2,3,4,5]
array_filter($array, is_and('is_positive', is_not('is_truthy'))); // [2,3,4,5]
array_filter($array, is_xor('is_positive', 'is_truthy')); // [2,3,4,5]
```

```
is_month_name("january") //true
```

A lot of effort has been put into making the predicates locale aware. An example of built-in support:

```
putenv("lang=kr_KR");

is_month_name('february') //true
is_month_name('이월') //true
```

> **Note**Not all languages may be supported, as this is a work in progress. To help us add support, please submit a language [in discussions](https://github.com/soulshined/ft-predicates/discussions/categories/locale-request)!

For verbose documentation, see the [documentation page](https://soulshined.github.io/ft-predicates/)

To request a new predicate, feature or locale support - review the [discussion contributing guidelines](https://github.com/soulshined/ft-predicates/discussions/1)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Every ~1 days

Total

2

Last Release

1189d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a9ec50a967899163d0d22508c6e3b72b930f51e2d36213ac0bc782910ad46a2?d=identicon)[davidfreer](/maintainers/davidfreer)

---

Top Contributors

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

---

Tags

filtercallbackpredicatepredicatesiscallacks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ft-predicates/health.svg)

```
[![Health](https://phpackages.com/badges/ft-predicates/health.svg)](https://phpackages.com/packages/ft-predicates)
```

###  Alternatives

[clue/stream-filter

A simple and modern approach to stream filtering in PHP

1.7k261.7M7](/packages/clue-stream-filter)[laminas/laminas-filter

Programmatically filter and normalize data and files

9428.0M150](/packages/laminas-laminas-filter)[friendsofcake/search

CakePHP Search plugin using PRG pattern

1742.0M37](/packages/friendsofcake-search)[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

401.1M9](/packages/htmlawed-htmlawed)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[outl1ne/nova-detached-filters

This Laravel Nova package allows you to detach filters from the filter dropdown

64343.5k](/packages/outl1ne-nova-detached-filters)

PHPackages © 2026

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