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

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

whotrades/formatter
===================

Universal formatter

v1.0.2(5y ago)11.1kPHPPHP &gt;=7.0

Since Feb 2Pushed 5y ago3 watchersCompare

[ Source](https://github.com/WhoTrades/formatter)[ Packagist](https://packagist.org/packages/whotrades/formatter)[ RSS](/packages/whotrades-formatter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

formatter
=========

[](#formatter)

Universal formatter

Example:

---

Get particular format class instance

```
$format = \whotrades\formatter\Formatter::factory('{
	"root": {
		"node1": ["text1", "text2"],
		"node2": "text3",
		"node3": ["text4", "text5"]
	}
}');

```

---

Get format name

```
var_dump($format->getFormatName());

```

```
string 'json' (length=4)

```

---

Fine nodes using xpath requests

- return value of node if node is scalar, otherwise return node with content

```
var_dump($format->getValueListByXPathList(["//node2", "//node3"]));

```

```
array (size=2)
  0 => string 'text3' (length=5)
  1 => string '{"node3":["text4","text5"]}' (length=27)

```

---

Get as array

```
var_dump($format->getAsArray());

```

```
array (size=1)
  'root' =>
    array (size=3)
      'node1' =>
        array (size=2)
          0 => string 'text1' (length=5)
          1 => string 'text2' (length=5)
      'node2' => string 'text3' (length=5)
      'node3' =>
        array (size=2)
          0 => string 'text4' (length=5)
          1 => string 'text5' (length=5)

```

---

For user friendly rendering

```
var_dump($format->getFormatted());

```

```
string 'Array
(
    [root] => Array
        (
            [node1] => Array
                (
                    [0] => text1
                    [1] => text2
                )

            [node2] => text3
            [node3] => Array
                (
                    [0] => text4
                    [1] => text5
                )

        )

)
' (length=344)

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~429 days

Total

3

Last Release

2166d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9bb0d3a488eeb7af026f1b614186e7643a92fba1dc0f103fb29acde1151e4522?d=identicon)[whotrades](/maintainers/whotrades)

---

Top Contributors

[![AntonAcc](https://avatars.githubusercontent.com/u/10139787?v=4)](https://github.com/AntonAcc "AntonAcc (7 commits)")[![mrodikov](https://avatars.githubusercontent.com/u/6941044?v=4)](https://github.com/mrodikov "mrodikov (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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