PHPackages                             pleonasm/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. pleonasm/bloom-filter

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

pleonasm/bloom-filter
=====================

A pure PHP implementation of a Bloom Filter

1.0.4(3mo ago)78769.5k↓15.7%13[1 issues](https://github.com/pleonasm/bloom-filter/issues)6BSD-2-ClausePHPPHP &gt;=8.0CI failing

Since Oct 8Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/pleonasm/bloom-filter)[ Packagist](https://packagist.org/packages/pleonasm/bloom-filter)[ RSS](/packages/pleonasm-bloom-filter/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (6)Used By (6)

[![CI Status](https://github.com/pleonasm/bloom-filter/actions/workflows/php.yml/badge.svg)](https://github.com/pleonasm/bloom-filter/actions/workflows/php.yml)[![Coverage Status](https://camo.githubusercontent.com/bb809a09ff718e2b6b42971279b4f2ef40e5de0ebbf467a9c2659860c1cd1aa7/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f706c656f6e61736d2f626c6f6f6d2d66696c7465722f62616467652e706e67)](https://coveralls.io/r/pleonasm/bloom-filter)

A Bloom Filter for PHP
======================

[](#a-bloom-filter-for-php)

This is a well tested implementation of a [bloom filter](https://en.wikipedia.org/wiki/Bloom_filter)for PHP. It has the following features:

1. Efficient memory use for bit array (as efficient as PHP can be anyway).
2. A way to get a raw version of the filter for transport to other systems.
3. Ability to restore said raw filter back into a usable one.
4. Auto-calculates optimal hashing and bit array size based on desired set size and false-positive probability.
5. Auto-generates hashing functions as needed.

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

[](#installation)

Install via [Composer](https://getcomposer.org) (make sure you have composer in your path or in your project).

Put the following in your package.json:

```
{
    "require": {
        "pleonasm/bloom-filter": "*"
    }
}
```

Run `composer install`.

Usage
-----

[](#usage)

```
