PHPackages                             narrowspark/pretty-array - 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. narrowspark/pretty-array

Abandoned → [symfony/var-exporter](/?search=symfony%2Fvar-exporter)ArchivedLibrary

narrowspark/pretty-array
========================

Returns a pretty array for saving or output.

2.0.2(6y ago)11.2kMITPHPPHP ^7.2

Since Aug 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/narrowspark/pretty-array)[ Packagist](https://packagist.org/packages/narrowspark/pretty-array)[ Docs](http://github.com/narrowspark/pretty-array)[ RSS](/packages/narrowspark-pretty-array/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (3)Versions (2)Used By (0)

Narrowspark Pretty Array
========================

[](#narrowspark-pretty-array)

 [![](https://camo.githubusercontent.com/50fec965f375536d63a1bb7907f2e9445c1973c897954b6e51e41d74f49ed048/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6172726f77737061726b2f7072657474792d61727261792e7376673f7374796c653d666c61742d737175617265)](https://github.com/narrowspark/pretty-array/releases) [![](https://camo.githubusercontent.com/e243dd412fc99473435d040a0afcf80ae870af909aa4a9bfc418e03224cf8115/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e322e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/) [![](https://camo.githubusercontent.com/9b70eac7f1ab20ace3c9172b97755c22d2444fe2654272469a43ef95d2459009/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6e6172726f77737061726b2f7072657474792d61727261792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/narrowspark/pretty-array) [![](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://opensource.org/licenses/MIT)

Branch Status
-------------

[](#branch-status)

[![Travis branch](https://camo.githubusercontent.com/93e09719c179331ff05db8dad0a1925176ab28eba4b2df21d46e66fad382d7d5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e6172726f77737061726b2f7072657474792d61727261792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/narrowspark/pretty-array)[![Codecov branch](https://camo.githubusercontent.com/9b70eac7f1ab20ace3c9172b97755c22d2444fe2654272469a43ef95d2459009/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6e6172726f77737061726b2f7072657474792d61727261792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/narrowspark/pretty-array/branch/master)

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install this package:

```
composer require narrowspark/pretty-array
```

Usage
-----

[](#usage)

```
use Narrowspark\PrettyArray\PrettyArray;

$prettyArray = new PrettyArray();
```

If you just pass a array you will get this output.

```
/**
 * This is the output.
 *
 * [
 *     0 => 1,
 * ]
 */
$prettyArray->print([1]);
```

To let the array output start from 4 spaces, just change the indent level.

```
/**
 * This is the output.
 *
 *     [
 *         0 => 1,
 *     ]
 */
$prettyArray->print([1], 2);
```

You can add a type resolver to change the value output.

All supported types can be found on [php.net](http://php.net/manual/en/function.gettype.php)

```
$prettyArray->setResolver('object', function($value) {
    return 'foo'
});

/**
 * This is the output.
 *
 * [
 *    0 => 'foo',
 * ]
 */
$prettyArray->print(
    [
        0 => function() {
            return 'foo';
        },
    ],
);
```

Testing
-------

[](#testing)

You need to run:

```
$ php vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

If you would like to help take a look at the [list of issues](http://github.com/narrowspark/testing-helper/issues) and check our [Contributing](CONTRIBUTING.md) guild.

> **Note:** Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits
-------

[](#credits)

- [Daniel Bannert](https://github.com/prisis)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2467d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca62e19a98f43cce88fa6733762bebbe26f4e7ee0b3d8defdadfd0b7082f77a0?d=identicon)[dani33](/maintainers/dani33)

---

Top Contributors

[![prisis](https://avatars.githubusercontent.com/u/2716058?v=4)](https://github.com/prisis "prisis (16 commits)")

---

Tags

php72pretty-arraypretty-print-arrayprint-arraypretty arraynarrowsparkpretty-print-array

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/narrowspark-pretty-array/health.svg)

```
[![Health](https://phpackages.com/badges/narrowspark-pretty-array/health.svg)](https://phpackages.com/packages/narrowspark-pretty-array)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[symfony/http-foundation

Defines an object-oriented layer for the HTTP specification

8.6k877.8M5.2k](/packages/symfony-http-foundation)[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M8.0k](/packages/symfony-var-dumper)[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)[symfony/mime

Allows manipulating MIME messages

2.8k668.8M911](/packages/symfony-mime)

PHPackages © 2026

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