PHPackages                             ravjanisz/readablesize - 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. ravjanisz/readablesize

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

ravjanisz/readablesize
======================

readablesize

2271PHPCI failing

Since Oct 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ravjanisz/readablesize)[ Packagist](https://packagist.org/packages/ravjanisz/readablesize)[ RSS](/packages/ravjanisz-readablesize/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

readablesize
============

[](#readablesize)

[![Build Status](https://camo.githubusercontent.com/7cbbd8b21db1f84803679803abc771aacaf0cac60804886d8fa7acfb86c1099d/68747470733a2f2f7472617669732d63692e6f72672f7261766a616e69737a2f7265616461626c6573697a652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ravjanisz/readablesize)[![codecov](https://camo.githubusercontent.com/d651e0b40bd23b8a5e34c625cf3347865d08950391a99cc09dd3ef77b8f15e1c/68747470733a2f2f636f6465636f762e696f2f67682f7261766a616e69737a2f7265616461626c6573697a652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ravjanisz/readablesize)

Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it.

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

[](#requirements)

- PHP &gt;= 7.1
- (optional) PHPUnit to run tests.

Install
-------

[](#install)

Via Composer:

```
$ composer require ravjanisz/readablesize
```

Usage
-----

[](#usage)

```
// add settings instance
use Rav\Size\SizeSettings;
// add instance
use Rav\Size\Size;

//base for calculation can be added as SizeSettings constructor parameter
//SizeSettings::BINARY or SizeSettings::DECIMAL
$settings = new SizeSettings();
//set precision for size
$settings->setPrecision(2);

//new object instance
$this->size = new Size($settings);

//return '1.46KiB'
echo $this->size->human('1500');

//convert size
//return '0.01TiB'
echo $this->size->convert(Size::MB, Size::TB, '9500');
```

Documentation
-------------

[](#documentation)

None

Support the development
-----------------------

[](#support-the-development)

**Do you like this project? Support it by donating**

[![alt Buy me a coffee](https://raw.githubusercontent.com/ravjanisz/readablesize/master/docs/assets/bmc.png)](https://www.buymeacoffee.com/ravjanisz)License
-------

[](#license)

readablesize is licensed under the MIT License - see the LICENSE file for details

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28200514?v=4)[Rafał Janisz](/maintainers/ravjanisz)[@ravjanisz](https://github.com/ravjanisz)

---

Top Contributors

[![ravjanisz](https://avatars.githubusercontent.com/u/28200514?v=4)](https://github.com/ravjanisz "ravjanisz (5 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

### Embed Badge

![Health badge](/badges/ravjanisz-readablesize/health.svg)

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

###  Alternatives

[log1x/acf-sidebar-selector

A simple ACF sidebar selector field.

123.5k](/packages/log1x-acf-sidebar-selector)

PHPackages © 2026

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