amneale / byteform
PHP library for parsing byte amounts
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/amneale/byteform
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: 2025-10-01 00:09:42 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