PHPackages                             marioblazek/twig-byte-units-extension - 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. marioblazek/twig-byte-units-extension

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

marioblazek/twig-byte-units-extension
=====================================

Twig filters that format output of units of information by using ByteUnits library by Gabriele Lana

v1.1.0(4y ago)319.9k↑470%21MITPHPPHP ^7.1|^8.0CI failing

Since Jun 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/MarioBlazek/twig-byte-units-extension)[ Packagist](https://packagist.org/packages/marioblazek/twig-byte-units-extension)[ Docs](https://github.com/marioblazek/twig-byte-units-extension)[ RSS](/packages/marioblazek-twig-byte-units-extension/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

Byte Units Twig extension
=========================

[](#byte-units-twig-extension)

[![Build Status](https://camo.githubusercontent.com/43b5a3a94326454ffd38b9d5823f3148d97d24cfd44dc3d05f1ab1a7dc6036f1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4d6172696f426c617a656b2f747769672d627974652d756e6974732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/MarioBlazek/twig-byte-units-extension)[![Code Coverage](https://camo.githubusercontent.com/6cf1a316256c672905a3d72a91eeb46acf81fa62daaefe65d220970a122f363b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4d6172696f426c617a656b2f747769672d627974652d756e6974732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/MarioBlazek/twig-byte-units-extension)[![Downloads](https://camo.githubusercontent.com/4575abe884061a2d2f1a792ccc859a90c8319bb1cb3edd3494629dcac18fbc42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6172696f626c617a656b2f747769672d627974652d756e6974732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marioblazek/twig-byte-units-extension/stats)[![Latest stable](https://camo.githubusercontent.com/921499dd064fedb6244000cf520b864183f55134fd384d0e9da3eeab5601a7f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6172696f626c617a656b2f747769672d627974652d756e6974732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marioblazek/twig-byte-units-extension)[![License](https://camo.githubusercontent.com/2a2f0f21853dc00c66fc88b7b9e18ee1a9ce08d97d02d56de26e717cd5c662f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4d6172696f426c617a656b2f747769672d627974652d756e6974732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This package provides simple Twig filters that wrap [ByteUnits](https://github.com/gabrielelana/byte-units)lib by [Gabriele Lana](https://github.com/gabrielelana) which makes manipulation with informational units very easy.

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

[](#installation)

To install this extension, use Composer:

```
composer require marioblazek/twig-byte-units-extension

```

Using the extension
-------------------

[](#using-the-extension)

In PHP:

```
$twig = new Twig_Environment($loader, $options);

$twig->addExtension(new Marek\Twig\ByteUnitsExtension());
```

In a Symfony project, you can register the extension as a service:

```
services:
    twig.extension.byte_units:
        class: Marek\Twig\ByteUnitsExtension
        tags:
            - { name: twig.extension }
```

Once set up, you can use the following Twig filters:

- `1322000|byte_units_format_metric('MB')` - Returns value formated in MB as returned by `ByteUnits\Metric::format` method
- `1322000|byte_units_format_binary('MB')` - Returns value formated in MiB as returned by `ByteUnits\Binary::format` method
- `1322000|byte_units_bytes_metric` - Returns the number of bytes as string returned by `ByteUnits\Metric::numberOfBytes` method
- `1322000|byte_units_bytes_binary` - Returns the number of bytes as string returned by `ByteUnits\Binary::numberOfBytes` method

for more information please check [formating section](https://github.com/gabrielelana/byte-units/blob/master/README.md#formatting) on [byte-units repo](https://github.com/gabrielelana/byte-units).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~709 days

Total

3

Last Release

1530d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.1.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6605175?v=4)[Mario Blazek](/maintainers/MarioBlazek)[@MarioBlazek](https://github.com/MarioBlazek)

---

Top Contributors

[![MarioBlazek](https://avatars.githubusercontent.com/u/6605175?v=4)](https://github.com/MarioBlazek "MarioBlazek (15 commits)")[![djoos](https://avatars.githubusercontent.com/u/449510?v=4)](https://github.com/djoos "djoos (2 commits)")

---

Tags

symfonytemplatingtwigtwig-extensiontwig-filtersymfonytwigpackagetemplatingbyteunits of information

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marioblazek-twig-byte-units-extension/health.svg)

```
[![Health](https://phpackages.com/badges/marioblazek-twig-byte-units-extension/health.svg)](https://phpackages.com/packages/marioblazek-twig-byte-units-extension)
```

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.7M132](/packages/timber-timber)[symfony/ux-twig-component

Twig components for Symfony

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

Live components for Symfony

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

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)[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)[goetas/twital-bundle

Twital templating engine Symfony Bundle

206.8k](/packages/goetas-twital-bundle)

PHPackages © 2026

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