PHPackages                             smoren/bitmap-tools - 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. smoren/bitmap-tools

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

smoren/bitmap-tools
===================

Bitmap tools

v0.3.0(3y ago)3426MITPHPPHP &gt;=7.4.0

Since Aug 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/Smoren/bitmap-tools-php)[ Packagist](https://packagist.org/packages/smoren/bitmap-tools)[ RSS](/packages/smoren-bitmap-tools/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

bitmap-tools
============

[](#bitmap-tools)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/cdc77f1b09603218867904d9e87e890d1fcba0f5d2a4b96a3ddb928522f96b39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736d6f72656e2f6269746d61702d746f6f6c73)](https://camo.githubusercontent.com/cdc77f1b09603218867904d9e87e890d1fcba0f5d2a4b96a3ddb928522f96b39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736d6f72656e2f6269746d61702d746f6f6c73)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/be298696a7e3d627b560c8c9ce9ab57e0b9dfa8ca984bbdb48a88dffd11937eb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f536d6f72656e2f6269746d61702d746f6f6c732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Smoren/bitmap-tools-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/2e5c29d1301eca1b217b0834583f173b62de9627eff61686b8637fa6ae1adf37/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f536d6f72656e2f6269746d61702d746f6f6c732d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Smoren/bitmap-tools-php?branch=master)[![Build and test](https://github.com/Smoren/bitmap-tools-php/actions/workflows/test_master.yml/badge.svg)](https://github.com/Smoren/bitmap-tools-php/actions/workflows/test_master.yml/badge.svg)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Tools for working with bitmaps

### How to install to your project

[](#how-to-install-to-your-project)

```
composer require smoren/bitmap-tools

```

### Unit testing

[](#unit-testing)

```
composer install
composer test-init
composer test

```

### Usage

[](#usage)

#### Simple usage

[](#simple-usage)

```
use Smoren\BitmapTools\Models\Bitmap;

// Create bitmap by int value:
$bm = Bitmap::create(6); // bitmap: 110

// Create bitmap by true bit positions:
$bm = Bitmap::create([1, 2]); // bitmap: 110

// Basic operations:
$bm = Bitmap::create([0, 2]);
var_dump($bm->getValue()); // 5
var_dump($bm->toArray()); // [0, 2]
var_dump($bm->hasBit(0)); // true
var_dump($bm->hasBit(1)); // false
var_dump($bm->hasBit(2)); // true

$bm = Bitmap::create([0, 1, 2]);
var_dump($bm->getValue()); // 7
var_dump($bm->toArray()); // [0, 1, 2]

$bm = Bitmap::create([]);
var_dump($bm->getValue()); // 0
var_dump($bm->toArray()); // []

// Intersections:
$bm = Bitmap::create(7);
var_dump($bm->intersectsWith(Bitmap::create(1))); // true
var_dump($bm->intersectsWith(Bitmap::create([1, 2]))); // true

$bm = Bitmap::create(6);
var_dump($bm->intersectsWith(Bitmap::create(2))); // true
var_dump($bm->intersectsWith(Bitmap::create(0))); // false

// Inclusions:
$bm = Bitmap::create(6);
var_dump($bm->includes(Bitmap::create(2))); // true (in binary numbers: 110 includes 010)
var_dump($bm->includes(Bitmap::create(1))); // false (in binary numbers: 110 not includes 001)
var_dump($bm->includes(Bitmap::create(3))); // false (in binary numbers: 110 not includes 011)

// Additions:
$bm = Bitmap::create(2); // bitmap: 010
$bm = $bm->add(Bitmap::create(1)); // bitmap: 011
$bm = $bm->add(Bitmap::create(6)); // bitmap: 111

// Subtractions:
$bm = Bitmap::create(15); // bitmap: 1111
$bm = $bm->sub(Bitmap::create(6)); // bitmap: 1001
$bm = $bm->sub(Bitmap::create(3)); // bitmap: 1000
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

3

Last Release

1401d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7403235?v=4)[Smoren](/maintainers/smoren)[@Smoren](https://github.com/Smoren)

---

Top Contributors

[![Smoren](https://avatars.githubusercontent.com/u/7403235?v=4)](https://github.com/Smoren "Smoren (5 commits)")

---

Tags

bitmaphelperphphelperbitmap

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smoren-bitmap-tools/health.svg)

```
[![Health](https://phpackages.com/badges/smoren-bitmap-tools/health.svg)](https://phpackages.com/packages/smoren-bitmap-tools)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k129.4M832](/packages/barryvdh-laravel-ide-helper)[bryanjhv/slim-session

Session middleware and helper for Slim framework 4.

233990.5k16](/packages/bryanjhv-slim-session)[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

274691.7k4](/packages/laravelista-ekko)[beste/json

A simple JSON helper to decode and encode JSON

4225.4M3](/packages/beste-json)[chillerlan/php-settings-container

A container class for immutable settings objects. Not a DI container.

3432.2M22](/packages/chillerlan-php-settings-container)[kartik-v/yii2-helpers

A collection of useful helper functions for Yii Framework 2.0

883.1M29](/packages/kartik-v-yii2-helpers)

PHPackages © 2026

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