toolstud-io/si_format

PHP package to format numbers according to SI standards (milli, micro, nano... / Kilo, Mega, Giga...)

1.0.3 2021-12-05 13:03 UTC

This package is auto-updated.

Last update: 2024-04-05 18:24:20 UTC


README

Github: GitHub tag Tests Psalm

Packagist: Packagist Version Packagist Downloads

PHP package to format numbers according to SI standards (e.g. mm, millimeter, Km, GB, Gigabyte, Gibibyte)

Installation

You can install the package via composer:

composer require toolstud-io/si_format

Usage

$obj = new ToolstudIo\SiFormat(false,"m");
echo $obj->format(1000000);
// returns "1km"
echo $obj->format(.001);
// returns "1mm"

$obj = new ToolstudIo\SiFormat(false,"B",1024);
echo $obj->format(1024);
// returns "1KB"

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email author_email instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.