PHPackages                             thesis/formatter - 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. thesis/formatter

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

thesis/formatter
================

Thesis Formatter

0.1.0(1mo ago)036922MITPHPPHP ^8.2CI passing

Since Apr 13Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/thesis-php/formatter)[ Packagist](https://packagist.org/packages/thesis/formatter)[ Fund](https://www.tinkoff.ru/cf/5MqZQas2dk7)[ RSS](/packages/thesis-formatter/feed)WikiDiscussions 0.1.x Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (2)

Thesis Formatter
================

[](#thesis-formatter)

[![PHP Version Requirement](https://camo.githubusercontent.com/9a8c5ab797bd5c971a19aa8d5bb3f5919faa6ab707c18785f5aca1430e48aafd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7468657369732f666f726d61747465722f706870)](https://packagist.org/packages/thesis/formatter)[![GitHub Release](https://camo.githubusercontent.com/25df5b920cabdbad61d1f8bcee9794fb685f148c14fd326960a603bd40c0a35a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7468657369732d7068702f666f726d6174746572)](https://github.com/thesis-php/formatter/releases)[![Code Coverage](https://camo.githubusercontent.com/31404abf5b3b68cf90c9df952fd52eae89cd166f663104c3e0b668a15611f59f/68747470733a2f2f636f6465636f762e696f2f67682f7468657369732d7068702f666f726d61747465722f6272616e63682f302e312e782f67726170682f62616467652e737667)](https://codecov.io/gh/thesis-php/formatter/tree/0.1.x)[![Mutation testing badge](https://camo.githubusercontent.com/4eeebfb91d5b992fcbf2d252935f4fd66654857601b6c97f96417a948c3276b5/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532467468657369732d706870253246666f726d6174746572253246302e312e78)](https://dashboard.stryker-mutator.io/reports/github.com/thesis-php/formatter/0.1.x)

A collection of functions for formatting PHP values and code elements into human-readable strings. Useful for error messages, exceptions, and debugging output.

Installation
------------

[](#installation)

```
composer require thesis/formatter
```

Functions
---------

[](#functions)

All functions are in the `Thesis\Formatter` namespace.

### `format(mixed $value): string`

[](#formatmixed-value-string)

Formats any PHP value.

```
format(null);                 // null
format(true);                 // true
format(42);                   // 42
format("it's fine");          // 'it\'s fine'
format([1, 2, 3]);            // list{1, 2, 3}
format(['a' => 1, 'b' => 2]); // array{a: 1, b: 2}
format((object)['x' => 1]);   // object{x: 1}
format(Status::Active);       // Status::Active
format(new MyClass());        // MyClass
format(fn() => null);         // function@src/foo.php:12()
```

### `formatClass(string|object $class): string`

[](#formatclassstringobject-class-string)

Formats a class name. Anonymous classes get a readable `file:line` label.

```
formatClass(MyClass::class); // MyClass
formatClass(new MyClass());  // MyClass
formatClass(new class {});   // class@src/foo.php:42
```

### `formatFunction(callable $function): string`

[](#formatfunctioncallable-function-string)

Formats a callable.

```
formatFunction('strlen');                       // strlen()
formatFunction('MyClass::myMethod');            // MyClass::myMethod()
formatFunction([MyClass::class, 'myMethod']);   // MyClass::myMethod()
formatFunction(fn() => null);                   // function@src/foo.php:12()
formatFunction(new MyInvokable());              // MyInvokable()
```

### `formatParameter(callable $function, int|string $parameter): string`

[](#formatparametercallable-function-intstring-parameter-string)

Formats a parameter reference by index or name.

```
formatParameter('myFunction', 'value');  // myFunction($value)
formatParameter('myFunction', 0);        // myFunction($0)
```

### `formatProperty(string|object $class, string $property): string`

[](#formatpropertystringobject-class-string-property-string)

Formats a property reference.

```
formatProperty(MyClass::class, 'name');  // MyClass::$name
formatProperty(new MyClass(), 'name');   // MyClass::$name
```

### Reflection-based functions

[](#reflection-based-functions)

Convenient wrappers around the functions above.

FunctionExample output`formatReflectedClass(\ReflectionClass $class)``MyClass``formatReflectedFunction(\ReflectionFunctionAbstract $function)``MyClass::myMethod()``formatReflectedParameter(\ReflectionParameter $parameter)``MyClass::myMethod($param)``formatReflectedProperty(\ReflectionProperty $property)``MyClass::$name``formatReflectedType(?\ReflectionType $type)``string|int`, `?Foo`, `A&B`

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% 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 ~0 days

Total

2

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552865?v=4)[Valentin Udaltsov](/maintainers/vudaltsov)[@vudaltsov](https://github.com/vudaltsov)

---

Top Contributors

[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (20 commits)")[![Evgymart](https://avatars.githubusercontent.com/u/111608901?v=4)](https://github.com/Evgymart "Evgymart (1 commits)")[![whiskey-coder](https://avatars.githubusercontent.com/u/82096206?v=4)](https://github.com/whiskey-coder "whiskey-coder (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thesis-formatter/health.svg)

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

###  Alternatives

[nxp/russian-porter-stemmer

Russian porter stemmer

4491.2k1](/packages/nxp-russian-porter-stemmer)[webgriffe/sylius-upgrade-plugin

Helps you upgrade your Sylius app to a new version.

13106.7k](/packages/webgriffe-sylius-upgrade-plugin)[joegreen0991/hyperloglog

A hyper log log with min hash data structure library, for counting cardinalities. Union and intersection capable

2116.8k](/packages/joegreen0991-hyperloglog)

PHPackages © 2026

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