Readable: Raw values, readable output
Turn 1250000 into 1.3M, 1536 bytes into 1.5 KiB, 3661 seconds into 1 hour 1 minute 1 second and 1234.5 into USD 1,234.50, with one static call and the same output on every machine.
Everything you need to show values to humans
Six focused classes with static methods. No setup, no state, no framework.
Readable Numbers
Grouped thousands, 1.2M-style compact numbers, percentages, ordinals and numbers spelled out in words.
Byte Sizes
SI KB or binary KiB, never mixed, plus Bytes::parse('10 MB') to go back to an integer.
Money
ISO 4217 codes with the right minor units, so JPY has no decimals and KWD has three.
Durations
Seconds or two dates to 2 days 4 hours, with long or short units and a parts limit.
Optional Locales
Pass a locale such as de_DE to use Intl. Leave it out for a deterministic English formatter.
Predictable Edge Cases
Half-up rounding, carry-over to the next unit and no -0.00, on every PHP version.
A quick look
One static call per value, wherever you render it.
1use Pharaonic\Readable\{Bytes, Duration, Money, Number};2 3Number::compact(1250000); // "1.3M"4Number::percentage(0.756, 1); // "75.6%"5Number::ordinal(21); // "21st"6Bytes::format(1536, binary: true); // "1.5 KiB"7Money::format(1234.5, 'USD'); // "USD 1,234.50"8Money::format(1234.5, 'EUR', locale: 'de_DE'); // "1.234,50 €"9Duration::format(90061, parts: 2); // "1 day 1 hour"Readable Questions
Quick answers about installing and using Readable.
What is Readable?
Human-friendly formatting for plain PHP. Turn numbers, byte sizes, money and durations into readable text, with predictable output and optional Intl locales. It's a free, open-source PHP package by Pharaonic.
How do I install Readable?
Run composer require pharaonic/php-readable in your project's root directory.
What does Readable require?
The latest release requires PHP 8.5+.
Do I need the intl extension?
No. Without a locale, every formatter uses a built-in English formatter that gives the same output on every machine. You only need ext-intl when you pass a locale such as de_DE or ar_EG.
Does it work with Laravel, Symfony or other frameworks?
Yes. The classes are plain static methods with no framework dependency, no configuration and no global state, so you can call them from any PHP code.
Is 1 KB 1000 or 1024 bytes?
Bytes::format()uses SI units (KB,MB) by default. Passbinary: truefor IEC units (KiB,MiB), where 1 KiB is 1024 bytes. The two are never mixed.
Is Readable free to use?
Yes. Readable is open source under the MIT license, so you can use it in personal and commercial projects.
Where can I find the Readable documentation?
Read the Readable documentation for installation, usage and examples.
How do I report a bug or contribute to Readable?
Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.
Ready to dig in?
Read the full documentation for installation, locales, numbers, byte sizes, money, durations, string and array helpers, the complete API reference and real-world examples.