Skip to content

Format number according to SI standards: kilo/mega/giga/tera

License

Notifications You must be signed in to change notification settings

toolstud-io/si_format

Repository files navigation

PHP package to format number according to SI standards

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.

About

Format number according to SI standards: kilo/mega/giga/tera

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages