PHPackages                             withinboredom/bytes - 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. withinboredom/bytes

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

withinboredom/bytes
===================

Convert between bytes

v1.1.0(2y ago)317MITPHPPHP &gt;=8.3

Since Feb 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/withinboredom/bytes)[ Packagist](https://packagist.org/packages/withinboredom/bytes)[ RSS](/packages/withinboredom-bytes/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Bytes
=====

[](#bytes)

This library allows you to create define data units in a nearly native way, compare them, and convert between them.

Use this:

```
composer require withinboredom/bytes

```

This library is unusual!
------------------------

[](#this-library-is-unusual)

The following code is 100% valid:

```
$kb = \Withinboredom\Bytes\Kilobytes(128)->multiply(1000);
$mb = \Withinboredom\Bytes\Megabytes(125);
$tb = \Withinboredom\Bytes\Terrabytes(1);

$arr = [$kb, $mb, $tb];
// sort the array
usort($arr, \Withinboredom\Bytes\Bytes::compare(...));

// values with the same units are always triple-equal to each other
assert($kb->megabytes() === $mb);

// values with the same units are always natively comparable
assert($mb < $tb->megabytes());

// you can always expect a certain unit
function test(\Withinboredom\Bytes\Megabytes $megabytes): void;

// or convert them to your expected unit in your body
function test(\Withinboredom\Bytes\DataUnit $size): void;

// get base-2 sized values
echo $kb->getBinaryValue();

// or si-units
echo $kb->getSiValue();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Total

2

Last Release

860d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1883296?v=4)[Rob Landers](/maintainers/withinboredom)[@withinboredom](https://github.com/withinboredom)

---

Top Contributors

[![withinboredom](https://avatars.githubusercontent.com/u/1883296?v=4)](https://github.com/withinboredom "withinboredom (8 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/withinboredom-bytes/health.svg)

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

PHPackages © 2026

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