Search by

pharaonic / php-readable

Pharaonic

Framework-agnostic, human-friendly formatting for PHP: numbers, bytes, money, durations, plus small array and string inspection helpers.


README

PHP Version : 8.5 License Tests
Source Packagist Version Packagist Downloads

Human-friendly numbers, sizes, money and durations for PHP.

Format numbers, byte sizes, money and durations into readable text with predictable output, plus optional Intl locales.

Installation

composer require pharaonic/php-readable

Usage

use Pharaonic\Readable\{Bytes, Duration, Money, Number};

Number::compact(1250000);           // "1.3M"
Bytes::format(1536, binary: true);  // "1.5 KiB"
Money::format(1234.5, 'USD');       // "USD 1,234.50"
Duration::format(3661);             // "1 hour 1 minute 1 second"

Documentation

Full documentation: PHP Readable Documentation.

Support & Security

See SUPPORT.md and SECURITY.md. Contributions are welcome; see CONTRIBUTING.md.

License

MIT. See LICENSE.