PHPackages                             1tomany/twig-filesize - 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. [Templating &amp; Views](/categories/templating)
4. /
5. 1tomany/twig-filesize

ActiveLibrary[Templating &amp; Views](/categories/templating)

1tomany/twig-filesize
=====================

A Twig extension to render human readable filesizes

v0.0.1(1y ago)0245MITPHPPHP &gt;=8.1

Since May 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/1tomany/twig-filesize)[ Packagist](https://packagist.org/packages/1tomany/twig-filesize)[ RSS](/packages/1tomany-twig-filesize/feed)WikiDiscussions main Synced today

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

Twig Extension for Calculating Filesize
=======================================

[](#twig-extension-for-calculating-filesize)

This Twig extension allows you to easily convert an integer, in bytes, to a human readable string with the correct unit.

Installation
------------

[](#installation)

Install the library with Composer:

```
composer require 1tomany/twig-filesize

```

Tag the `OneToMany\Twig\FilesizeExtension` as a Twig extension in your services configuration:

```
services:
    OneToMany\Twig\MailtoExtension:
        tags: [twig.extension]
```

Usage
-----

[](#usage)

This extension exposes a single filter named `filesize` with the following arguments:

- `scale`: The number of decimals to display. The `scale` must be between `0` and `4`, inclusive, and has a default value of `0`.
- `spacer`: A string that separates the filesize and unit. The `spacer` is an empty string by default.

```
{{ 851856|filesize(1) # 831.9KB }}
{{ 851856|filesize(0, ' ') # 832 KB }}
```

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

Credits
-------

[](#credits)

- [Vic Cherubini](https://github.com/viccherubini), [1:N Labs, LLC](https://1tomany.com)

License
-------

[](#license)

The MIT License

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance46

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

414d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60762?v=4)[Vic Cherubini](/maintainers/viccherubini)[@viccherubini](https://github.com/viccherubini)

---

Top Contributors

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

---

Tags

twigfilesizefile-size

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/1tomany-twig-filesize/health.svg)

```
[![Health](https://phpackages.com/badges/1tomany-twig-filesize/health.svg)](https://phpackages.com/packages/1tomany-twig-filesize)
```

###  Alternatives

[symfony/ux-twig-component

Twig components for Symfony

22018.6M355](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1647.0M128](/packages/symfony-ux-live-component)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

16126.1k1](/packages/symfony-ux-toolkit)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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