amneale / byteform
There is no license information available for the latest version (v1.2.0) of this package.
PHP library for parsing byte amounts
v1.2.0
2022-05-29 10:48 UTC
Requires
- php: ^7.4|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpspec/phpspec: ^7.2
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-10-29 06:18:30 UTC
README
PHP library for parsing and formatting byte amounts
Installing
composer require amneale/byteform
Usage
Parsing byte amounts
$parser = new \Amneale\ByteForm\ByteParser(); $parser->parseBytes("1.5KB"); // int(1536)
Formatting byte amounts
$formatter = new \Amneale\ByteForm\ByteFormatter(); $formatter->formatBytes(1536); // "1.50KB" $formatter->formatBytes(1536, 1); // "1.5KB"
Contributing
Running tests
byteform uses phpspec to drive development
make test
Fixing code style
Code style rules are defined in .php_cs.dist
. These rules are used to automatically fix any code style discrepancies
make fmt