PHPackages                             razorpay/php-bloom-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. [Search &amp; Filtering](/categories/search)
4. /
5. razorpay/php-bloom-filter

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

razorpay/php-bloom-filter
=========================

The best way to check object existence and save memory and disk usage.

0.8.0(10y ago)0193BSD-3-ClausePHPPHP &gt;=5.3

Since Apr 29Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (3)Used By (0)

php.bloom.filter
================

[](#phpbloomfilter)

[![Build Status](https://camo.githubusercontent.com/86549c6c52959eb99cf7236605833f916c7a936bc53587cce35d73793eb408b2/68747470733a2f2f7472617669732d63692e6f72672f72617a6f727061792f7068702d626c6f6f6d2d66696c7465722e706e67)](https://travis-ci.org/razorpay/php-bloom-filter)

[Bloom filter](http://en.wikipedia.org/wiki/Bloom_filter) - is the best way to check object existance and save memory and disk usage.

### Usage

[](#usage)

Examples and benchmarks are available in examples directory.

##### Basic parameters:

[](#basic-parameters)

- **entries\_max** (int) Maximal number of entries objects. Default: 100.
- **error\_chance** (float) (0;1) Chance of error check existance. Used for automatic setup next 2 parameters. Default: 0.001.
- **set\_size** (int) Size of set object. Default: calculated.
- **hash\_count** (int) Count of unique hash Objects. Default: calculated.
- **counter** (boolean) Uses only if ypu want to remove elements too. Slows down. Default: false.
- **hash** (array) Parameters for Hash objects.
- **strtolower** (boolean) Put string to lower case or not. Default: true;

##### Simple code example:

[](#simple-code-example)

```
use Razorpay\BloomFilter\Bloom;

$parameters = array(
  'entries_max' => 2
);
$bloom = new Bloom($parameters);

/**
* Set value to Bloom filter
* You can put single string or array of infinite deep of strings
*
* @param mixed
* @return BloomObject
*/
$bloom->set('Some string');
echo $bloom->has('Some string'); //true
echo $bloom->has('Some string', false); //0

/**
* Test set with given array or string, to check it existance
* You can put single string or array of infinite deep of strings
*
* @param mixed (array) or (string)
* @param boolean return boolean or float number of tests
* @return mixed (array) or (boolean) or (float)
*/
echo $bloom->has('Other string'); //false

/**
* Unset value from Bloom filter
* You can put single string or array of infinite deep of strings
* Only works with counter parameter
* @param mixed
* @return mixed (boolean) or (array)
*/
$bloom->delete('Some string');
echo $bloom->has('Some string'); //false
```

##### Caching

[](#caching)

You can also cache the whole object, just using serialize() and unserialize() functions

##### When to use

[](#when-to-use)

- Get/Set operations are more than 0.001
- You need a fast check with big set, more than 100 000 entries

##### Use cases:

[](#use-cases)

- to cooldown HDD usage
- to speedup checking of object existence (with counter 40% slower, but still more faster than native)
- to save memory

##### License:

[](#license)

BSD-3-Clause

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.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

Unknown

Total

1

Last Release

3663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa973df833a74ee917bc597bb968c517dc144ac8be96001538b888072e9c19a8?d=identicon)[razorpay](/maintainers/razorpay)

---

Top Contributors

[![captn3m0](https://avatars.githubusercontent.com/u/584253?v=4)](https://github.com/captn3m0 "captn3m0 (14 commits)")[![cabello](https://avatars.githubusercontent.com/u/60936?v=4)](https://github.com/cabello "cabello (2 commits)")[![Letoile](https://avatars.githubusercontent.com/u/6118767?v=4)](https://github.com/Letoile "Letoile (1 commits)")[![mhor](https://avatars.githubusercontent.com/u/4103719?v=4)](https://github.com/mhor "mhor (1 commits)")[![ThomasWunderlich](https://avatars.githubusercontent.com/u/796958?v=4)](https://github.com/ThomasWunderlich "ThomasWunderlich (1 commits)")

---

Tags

filterbloom

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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.0M148](/packages/laminas-laminas-filter)[pleonasm/bloom-filter

A pure PHP implementation of a Bloom Filter

76745.5k6](/packages/pleonasm-bloom-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-input-filter

An input filter for Laravel Nova

24822.7k](/packages/outl1ne-nova-input-filter)

PHPackages © 2026

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