2017 © Pedro Peláez
 

library pretty-array

Returns a pretty array for saving or output.

image

narrowspark/pretty-array

Returns a pretty array for saving or output.

  • Wednesday, June 6, 2018
  • by dani33
  • Repository
  • 2 Watchers
  • 1 Stars
  • 848 Installations
  • PHP
  • 5 Dependents
  • 3 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 298 % Grown

The README.md

Narrowspark Pretty Array

, (*1)

Branch Status

Travis branch Codecov branch, (*2)

Installation

Use Composer to install this package:, (*3)

composer require narrowspark/pretty-array

Usage

use Narrowspark\PrettyArray\PrettyArray;

$prettyArray = new PrettyArray();

If you just pass a array you will get this output., (*4)

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

To let the array output start from 4 spaces, just change the indent level., (*5)

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

You can add a type resolver to change the value output., (*6)

All supported types can be found on php.net, (*7)

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

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

Testing

You need to run: bash $ php vendor/bin/phpunit, (*8)

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild., (*9)

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., (*10)

Credits

License

The MIT License (MIT). Please see License File for more information., (*11)

The Versions

06/06 2018
15/05 2018

v1.0.0

1.0.0.0 http://github.com/narrowspark/pretty-array

Returns a pretty array for saving or output.

  Sources   Download

MIT

The Requires

  • php ^7.2

 

The Development Requires

narrowspark pretty-array pretty-print-array