amneale/byteform

There is no license information available for the latest version (v1.2.0) of this package.

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

v1.2.0 2022-05-29 10:48 UTC

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