PHPackages                             andrewdalpino/okbloomer - 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. andrewdalpino/okbloomer

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

andrewdalpino/okbloomer
=======================

An autoscaling Bloom filter with ultra-low memory usage for PHP.

1.0.0(4y ago)5932.4k—2.5%2[2 PRs](https://github.com/andrewdalpino/OkBloomer/pulls)1MITPHPPHP &gt;=7.4

Since Jan 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/andrewdalpino/OkBloomer)[ Packagist](https://packagist.org/packages/andrewdalpino/okbloomer)[ GitHub Sponsors](https://github.com/sponsors/andrewdalpino)[ RSS](/packages/andrewdalpino-okbloomer/feed)WikiDiscussions master Synced 1mo ago

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

Ok Bloomer
==========

[](#ok-bloomer)

An autoscaling [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) with ultra-low memory footprint for PHP. Ok Bloomer employs a novel layered filtering strategy that allows it to expand while maintaining an upper bound on the false positive rate. Each layer is comprised of a bitmap that remembers the hash signatures of the items inserted so far. If an item gets caught in the filter, then it has probably been seen before. However, if an item passes through the filter, then it definitely has never been seen before.

- **Ultra-low** memory footprint
- **Autoscaling** works on streaming data
- **Bounded** maximum false positive rate
- **Open-source** and free to use commercially

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

[](#installation)

Install into your project using [Composer](https://getcomposer.org/):

```
$ composer require andrewdalpino/okbloomer
```

### Requirements

[](#requirements)

- [PHP](https://php.net/manual/en/install.php) 7.4 or above

Bloom Filter
------------

[](#bloom-filter)

A probabilistic data structure that estimates the prior occurrence of a given item with a maximum false positive rate.

### Parameters

[](#parameters)

\#NameDefaultTypeDescription1maxFalsePositiveRate0.01floatThe false positive rate to remain below.2numHashes4int, nullThe number of hash functions used, i.e. the number of slices per layer. Set to `null` for auto.3layerSize32000000intThe size of each layer of the filter in bits.4hashFncallable'crc32'The hash function that accepts a string token and returns an integer.### Example

[](#example)

```
use OkBloomer\BloomFilter;

$filter = new BloomFilter(0.01, 4, 32000000);

$filter->insert('foo');

echo $filter->exists('foo');

echo $filter->existsOrInsert('bar');

echo $filter->exists('bar');
```

```
true

false

true

```

Testing
-------

[](#testing)

To run the unit tests:

```
$ composer test
```

Static Analysis
---------------

[](#static-analysis)

To run static code analysis:

```
$ composer analyze
```

Benchmarks
----------

[](#benchmarks)

To run the benchmarks:

```
$ composer benchmark
```

References
----------

[](#references)

- \[1\] P. S. Almeida et al. (2007). Scalable Bloom Filters.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community11

Small or concentrated contributor base

Maturity50

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 ~345 days

Total

2

Last Release

1230d ago

Major Versions

1.0.0 → 2.0.x-dev2023-01-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/643b22cfe15a5f3ff42dc06ce98f1e5024b6e4578fc9627a058097f5046164d8?d=identicon)[andrewdalpino](/maintainers/andrewdalpino)

---

Top Contributors

[![andrewdalpino](https://avatars.githubusercontent.com/u/18690561?v=4)](https://github.com/andrewdalpino "andrewdalpino (2 commits)")

---

Tags

Bloom Filterscalable bloom filterlayered bloom filter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/andrewdalpino-okbloomer/health.svg)

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

###  Alternatives

[smile/module-store-locator

Smile Store Locator

51516.6k4](/packages/smile-module-store-locator)[gpslab/base64uid

Generate UID like YouTube

68103.4k](/packages/gpslab-base64uid)

PHPackages © 2026

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