KiloMega#

Packagist GitLab GitHub Bitbucket Gitea

A metric formatter for PHP.

Installation#

composer require arokettu/kilo-mega

Documentation#

Formatting a metric value#

<?php
use function \Arokettu\KiloMega\format_metric;
echo format_metric(1000, suffix: 'W'); // 1.0 kW

Formatting a byte or bit value#

<?php
use function \Arokettu\KiloMega\format_bytes;
echo format_bytes(1234); // 1.2 KiB

License#

The library is available as open source under the terms of the MIT License.