PHPackages                             mindplay/readable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mindplay/readable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mindplay/readable
=================

Formats PHP values as human-readable strings

1.2.3(1y ago)8549.8k—1%27MPL-2.0PHPPHP ^8.0

Since May 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mindplay-dk/readable)[ Packagist](https://packagist.org/packages/mindplay/readable)[ RSS](/packages/mindplay-readable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (12)Used By (7)

mindplay/readable
=================

[](#mindplayreadable)

A few simple functions to format any kind of PHP value or type as human-readable.

[![PHP Version](https://camo.githubusercontent.com/487804500a039aee09e5d93e41b745b4cd68dcc0fdf801e67d26d30b93f83358/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d626c75652e737667)](https://packagist.org/packages/mindplay/readable)[![Build Status](https://github.com/mindplay-dk/readable/actions/workflows/ci.yml/badge.svg)](https://github.com/mindplay-dk/readable/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/82e695f4f7a101cffa0559cc09e07b89c6211388a60e27a93bcf660e6beb822f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e64706c61792d646b2f7265616461626c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mindplay-dk/readable/?branch=master)[![License](https://camo.githubusercontent.com/0a34271b130f15aa109c3625a51302a3c6b584e3e1df0d19cd53b9741ac02dd5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d504c2d2d322e302d677265656e)](https://opensource.org/license/mpl-2-0)

Mainly, this is intended to help you produce better error-messages:

```
if (!is_int($value)) {
    throw new UnexpectedValueException("expected integer, got: " . readable::typeof($value));
} else if ($value > 100) {
    throw new RangeException("expected value up to 100, got: " . readable::value($value));
}
```

Note that this library is not "better var\_dump" - it won't color-code things or dump deep object graphs. There are plenty of other libraries for that sort of thing.

Presently, this library consists of these simple functions:

- `readable::value($value)` formats any single PHP value as human-readable.
- `readable::values($array)` formats an array of (mixed) values as human-readable.
- `readable::typeof($value)` returns the type of value (or class name) for any given value.
- `readable::callback($callable)` formats any `callable` as human-readable.
- `readable::severity($int)` returns for example `E_WARNING` as human-readable `"Warning"`.
- `readable::error($exception)` returns a human-readable `Exception`/`Error` summary.
- `readable::trace($trace)` formats a stack-trace with file-names, line-numbers, function-names and (optionally) arguments.
- `readable::path($path)` removes the project root path from the start of a path.

The latter function `callback()` will fall back to regular `value()` formatting if the given value is not a callable - this function is preferable when a given value was expected to be `callable`, e.g. recognizes function-names as strings and objects implementing `__invoke()`.

See the [source code](src/readable.php) and [test suite](test/test.php) for all formatting features.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~448 days

Recently: every ~564 days

Total

8

Last Release

523d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4

1.2.0PHP ^8.1

1.2.2PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9445f567f43ee7a963270651e40e533634586f959e4df3d5398d001b1cb49be8?d=identicon)[mindplay.dk](/maintainers/mindplay.dk)

---

Top Contributors

[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (36 commits)")

### Embed Badge

![Health badge](/badges/mindplay-readable/health.svg)

```
[![Health](https://phpackages.com/badges/mindplay-readable/health.svg)](https://phpackages.com/packages/mindplay-readable)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
