PHPackages                             ankitjain28may/prettysize - 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. ankitjain28may/prettysize

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

ankitjain28may/prettysize
=========================

Convert bytes to other sizes for prettier logging

v1.0(7y ago)31141MITPHPPHP &gt;=7.1

Since Nov 26Pushed 6y agoCompare

[ Source](https://github.com/ankitjain28may/prettysize)[ Packagist](https://packagist.org/packages/ankitjain28may/prettysize)[ RSS](/packages/ankitjain28may-prettysize/feed)WikiDiscussions master Synced yesterday

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

About prettysize
================

[](#about-prettysize)

prettysize was created by, and is maintained by [Ankit Jain](https://github.com/ankitjain28may), and is a helper utility to provide pretty printed file sizes.

[![Build Status](https://camo.githubusercontent.com/c122794e7bd4befb70f17d2764b1fc6e8ea54962157c4e46b15e4c55d63caa44/68747470733a2f2f7472617669732d63692e6f72672f616e6b69746a61696e32386d61792f70726574747973697a652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ankitjain28may/prettysize)[![Coverage Status](https://camo.githubusercontent.com/c5d5ba2189ed5cce82eff412bb2af55bd1f75ad222b33f399d5d4aadb218888f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616e6b69746a61696e32386d61792f70726574747973697a652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/ankitjain28may/prettysize?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/638acb821536f7e0bf2f0e2b4aa9505296c4341700a6ff3684e371fa7e9df121/68747470733a2f2f706f7365722e707567782e6f72672f616e6b69746a61696e32386d61792f70726574747973697a652f762f737461626c65)](https://packagist.org/packages/ankitjain28may/prettysize)

Installation &amp; Usage
------------------------

[](#installation--usage)

> **Requires [PHP 7.1+](https://php.net/releases/)**

Require prettysize using [Composer](https://getcomposer.org):

```
composer require ankitjain28may/prettysize
```

### Arguments

[](#arguments)

```
Pretty::pretty($size, $nospace, $one, $places);

/*
  $size : Size in bytes to be converted (Required)
  $nospace : Remove space from the output (Default - false)
  $one : Single character for the size (Default - false)
  $places : Number of decimal places to return (Default - 1)
 */
```

```
use Ankitjain28may\Prettysize\Pretty;

$size = Pretty::pretty(1024);
// $size = "1.0 kB"

$size = Pretty::pretty(1024, true, true, 2);
// $size = "1.00k"

$size = Pretty::pretty(1024, ['nospace' => true, 'one' => true, 'places' => 5]);
// $size = "1.00000k"
```

Contributing
------------

[](#contributing)

Thank you for considering to contribute to prettysize. You can also follow the twitter account for latest announcements or just come say hi!: [@ankitjain28may](https://twitter.com/ankitjain28may)

License
-------

[](#license)

prettysize is an open-sourced library licensed under the [MIT license](LICENSE.md).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

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

2725d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79b96139365daf0dd608b959d78729615f04e303e9cd665c3175356c9ec167bc?d=identicon)[ankitjain28](/maintainers/ankitjain28)

---

Top Contributors

[![ankitjain28may](https://avatars.githubusercontent.com/u/14014254?v=4)](https://github.com/ankitjain28may "ankitjain28may (9 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")

---

Tags

phputilityPrettySize

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ankitjain28may-prettysize/health.svg)

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

###  Alternatives

[bdelespierre/underscore

Underscore.js port in PHP

6943.7k1](/packages/bdelespierre-underscore)

PHPackages © 2026

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