PHPackages                             dragon-code/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dragon-code/pretty-array

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

dragon-code/pretty-array
========================

Simple conversion of an array to a pretty view

4.2.0(1y ago)177.6M—0.5%12MITPHPPHP ^8.0CI passing

Since Jan 25Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/TheDragonCode/pretty-array)[ Packagist](https://packagist.org/packages/dragon-code/pretty-array)[ Fund](https://boosty.to/dragon-code)[ Fund](https://yoomoney.ru/to/410012608840929)[ RSS](/packages/dragon-code-pretty-array/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (35)Used By (2)

Pretty Array
============

[](#pretty-array)

  ![Pretty Array](https://camo.githubusercontent.com/2dfb5b3caf7409edeb109db330be0c3ff2bff5ec485a2b2228fad34b2d067c2d/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f50726574747925323041727261792e706e673f7061747465726e3d746f706f677261706879267374796c653d7374796c655f3226666f6e7453697a653d3130307078266d643d312673686f7757617465726d61726b3d31267468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d647261676f6e2d636f64652532467072657474792d6172726179266465736372697074696f6e3d53696d706c652b636f6e76657273696f6e2b6f662b616e2b61727261792b746f2b612b7072657474792b7669657726696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)[![Stable Version](https://camo.githubusercontent.com/51c8a9f8681eae5c0ac6a6e356e52112110419914fc115787e65e0ca9cec2dcd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f546865447261676f6e436f64652f7072657474792d61727261793f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/pretty-array)[![Total Downloads](https://camo.githubusercontent.com/9ebb9bf9ab17591c3480158112841fe3dee2a741f615920ab52516e0c97746ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f647261676f6e2d636f64652f7072657474792d61727261792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/pretty-array)[![Github Workflow Status](https://camo.githubusercontent.com/4fe2a461a87a4db20495bd05df38a58165811729aec2b600e2975d1b918bdb5e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f546865447261676f6e436f64652f7072657474792d61727261792f706870756e69742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/TheDragonCode/pretty-array/actions)[![License](https://camo.githubusercontent.com/9f8a61e84de34d820261c44cef206dd35f1875fb7dc8d8ca91464efdff976fbe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f647261676f6e2d636f64652f7072657474792d61727261792e7376673f7374796c653d666c61742d737175617265)](LICENSE)

> Simple conversion of an array to a pretty view.

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

[](#installation)

To get the latest version of `Pretty Array` package, simply require the project using [Composer](https://getcomposer.org):

```
composer require dragon-code/pretty-array

```

Instead, you may of course manually update your `require` block and run `composer update` if you so choose:

```
{
    "require": {
        "dragon-code/pretty-array": "^4.0"
    }
}
```

Introduction
------------

[](#introduction)

> Q: Why did you create this package when there is a cooler [symfony/var-exporter](https://github.com/symfony/var-exporter)?

The big minus of package [symfony/var-exporter](https://github.com/symfony/var-exporter) is that it works differently with numeric keys.

For example, we have an array:

```
$array = [
    100 => 'foo',
    200 => 'bar',
    201 => 'baz',
    202 => 'qwe',
    205 => 'ert',
    206 => 'tyu'
];
```

When exporting through it, the file will contain the following content:

```
$array = [
    100 => 'foo',
    200 => 'bar',
    'baz',
    'qwe',
    205 => 'ert',
    'tyu'
];
```

> Q: Why do you think this is bad?

This package has a framework-independent base. However, it was originally developed as an assistant for the [Laravel Lang: HTTP Statuses](https://github.com/Laravel-Lang/http-statuses)package.

This package allows you to publish language translations of the HTTP Status Codes for the Laravel and Lumen frameworks.

A feature of the framework is that IDEs that help with development do not know how to read the numeric keys of arrays of translation files, so it was necessary to translate theminto a text equivalent.

This behavior includes [http-statuses.php](https://github.com/Laravel-Lang/http-statuses/blob/main/source/http-statuses.php) file:

```
