PHPackages                             navarr/binary-explode - 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. navarr/binary-explode

ActiveLibrary

navarr/binary-explode
=====================

Explode a number into it's binary components

v2.0.2(5mo ago)04.7k1MITPHPPHP ^8.2CI passing

Since Jan 6Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/navarr/binary-explode)[ Packagist](https://packagist.org/packages/navarr/binary-explode)[ GitHub Sponsors](https://github.com/navarr)[ RSS](/packages/navarr-binary-explode/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (6)Versions (8)Used By (0)

Binary Exploders
================

[](#binary-exploders)

[![Latest Stable Version](https://camo.githubusercontent.com/2b580952d5fcb1cee0cc8f14d284320b38d2108711478c5c59fc7f321eced03d/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f62696e6172792d6578706c6f64652f76)](https://packagist.org/packages/navarr/binary-explode)[![Total Downloads](https://camo.githubusercontent.com/11ffd45e5e79b5f96acd5757076bde16bb7935ca8f438cd330bc721c6a89232c/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f62696e6172792d6578706c6f64652f646f776e6c6f616473)](https://packagist.org/packages/navarr/binary-explode)[![Latest Unstable Version](https://camo.githubusercontent.com/a13c10062dcd86d149ade42e27aed337aba0f2a56c5c98b7f9db4d32e56a87a1/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f62696e6172792d6578706c6f64652f762f756e737461626c65)](https://packagist.org/packages/navarr/binary-explode)[![License](https://camo.githubusercontent.com/94af575b2059d73a0ebd0afa8de79ae80fe61d098ef060c5ce3f8796c2a774d3/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f62696e6172792d6578706c6f64652f6c6963656e7365)](https://packagist.org/packages/navarr/binary-explode)
[![Tests](https://github.com/navarr/binary-explode/actions/workflows/commit.yml/badge.svg)](https://github.com/navarr/binary-explode/actions/workflows/commit.yml/badge.svg)[![Code Coverage](https://camo.githubusercontent.com/5e1c661b796de931b40c03c46c941fdb95aaa303f7a38d255fd99438d371c7c8/68747470733a2f2f636f6465636f762e696f2f67682f6e61766172722f62696e6172792d6578706c6f64652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4248544b4f5a5a445233)](https://camo.githubusercontent.com/5e1c661b796de931b40c03c46c941fdb95aaa303f7a38d255fd99438d371c7c8/68747470733a2f2f636f6465636f762e696f2f67682f6e61766172722f62696e6172792d6578706c6f64652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4248544b4f5a5a445233)[![Mutation Score](https://camo.githubusercontent.com/4e0fd8bcd9623af66ec4874c92a76eba6586fcdccee7de34cd0e4e599ea4146f/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532466e617661727225324662696e6172792d6578706c6f64652532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/navarr/binary-explode/main)

This package provides two functions usable to convert a number into an array of it's binary components.

Examples:

1. \[1\]
2. \[2\]
3. \[2, 1\]
4. \[4\]
5. \[4, 1\]
6. \[4, 2\]
7. \[4, 2, 1\]

etc

Usage
-----

[](#usage)

### Installation

[](#installation)

```
composer require navarr/binary-explode`

```

### Shared Interface

[](#shared-interface)

This package provides a shared interface, `\Navarr\BinaryExploder\BinaryExploderInterface`. This interface takes an `int` and returns an `iterable` containing or generating the binary components of that `int`.

### \\Navarr\\BinaryExploder\\LinearBinaryExploder::explode(int $value) : iterable

[](#navarrbinaryexploderlinearbinaryexploderexplodeint-value--iterable)

Uses a linear algorithm that checks the logical AND of the number with increasing powers of 2.

This algorithm is typically fastest for numbers that are unlikely to be a power of 2.

### Navarr\\BinaryExploder\\LogarithmicBinaryExploder::explode(int $value) : iterable

[](#navarrbinaryexploderlogarithmicbinaryexploderexplodeint-value--iterable)

Uses a linear algorithm that checks the log(base 2) of the number and then it's remainders.

This algorithm is typically fastest for numbers that are likely to be a power of 2.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance70

Regular maintenance activity

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82.4% 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 ~639 days

Recently: every ~798 days

Total

6

Last Release

166d ago

Major Versions

v1.1.1 → v2.0.02021-12-20

PHP version history (3 changes)v1.0.0PHP &gt;=5.6

v2.0.0PHP ^7.1|^8

v2.0.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/24959115e049fb1d71612462e9106b345b3e0e6126439493514018cd440e8937?d=identicon)[navarr](/maintainers/navarr)

---

Top Contributors

[![navarr](https://avatars.githubusercontent.com/u/145128?v=4)](https://github.com/navarr "navarr (14 commits)")[![jpmc](https://avatars.githubusercontent.com/u/16089593?v=4)](https://github.com/jpmc "jpmc (3 commits)")

---

Tags

hacktoberfest

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/navarr-binary-explode/health.svg)

```
[![Health](https://phpackages.com/badges/navarr-binary-explode/health.svg)](https://phpackages.com/packages/navarr-binary-explode)
```

PHPackages © 2026

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