PHPackages                             aschmelyun/size - 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. aschmelyun/size

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

aschmelyun/size
===============

Simple PHP helper to convert bytes to different sizes

v1.0.0(3y ago)471.2kMITPHPPHP ^7.4|^8

Since Jul 19Pushed 3y ago2 watchersCompare

[ Source](https://github.com/aschmelyun/size)[ Packagist](https://packagist.org/packages/aschmelyun/size)[ RSS](/packages/aschmelyun-size/feed)WikiDiscussions main Synced 3w ago

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

Size
====

[](#size)

[![Current Version](https://camo.githubusercontent.com/55ece75d481841ae15866d01e62c66217a2d7acf4ce7082077791279b953dfa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617363686d656c79756e2f73697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aschmelyun/size)[![License](https://camo.githubusercontent.com/94481fa63fee7e36553cf1cdf65c58464c56471b200f0720ad268134f93c288a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617363686d656c79756e2f73697a652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/94481fa63fee7e36553cf1cdf65c58464c56471b200f0720ad268134f93c288a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617363686d656c79756e2f73697a652e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/b5bd089423a510e55e47d102919d27df36a1fcc1a60ea49d526aa27fc6c25691/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617363686d656c79756e2f73697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aschmelyun/size)

🧮 A super simple helper package for converting between different byte units.

```
composer require aschmelyun/size
```

Requirements
------------

[](#requirements)

- PHP 7.4 or higher

Usage
-----

[](#usage)

Instantiate the class with the data unit you're bringing in. By default, it'll return back the value in bytes. You can then tack on either a method or a property to convert that unit into a different one.

```
use Aschmelyun\Size\Size;

$bytesInTwoMegabytes = Size::MB(2); // 2097152

$gigabytesInTwoMegabytes = Size::MB(2)->toGB(); // 0.001953125

$kilobytesInTwoMegabytes = Size::MB(2)->KB; // 2048
```

**That's it!**

The available properties are: `B, KB, MB, GB, TB, PB, EB, ZB, YB`

Tests
-----

[](#tests)

Size comes with a small suite of tests powered by [Pest](https://pestphp.com/). To run them, clone this repository and then use:

```
./vendor/bin/pest
```

Contact Info
------------

[](#contact-info)

Have an issue? Submit it here! Want to get in touch or recommend a feature? Feel free to reach out to me on [Twitter](https://twitter.com/aschmelyun) for any other questions or comments.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](https://github.com/aschmelyun/size/blob/main/LICENSE.md) for more details.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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

Unknown

Total

1

Last Release

1436d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/89d40a36efd670c752d8d6e488192d9ae78b9ff49503cf6b671f46d17cb67768?d=identicon)[aschmelyun](/maintainers/aschmelyun)

---

Top Contributors

[![aschmelyun](https://avatars.githubusercontent.com/u/3395980?v=4)](https://github.com/aschmelyun "aschmelyun (7 commits)")[![SamuelMwangiW](https://avatars.githubusercontent.com/u/1807304?v=4)](https://github.com/SamuelMwangiW "SamuelMwangiW (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/aschmelyun-size/health.svg)

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

###  Alternatives

[morrislaptop/journal

A UI for Spatie's Laravel Event Sourcing

1734.1k](/packages/morrislaptop-journal)

PHPackages © 2026

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