2017 © Pedro Peláez
 

library repr

A library for generating string representations of any value, inspired by Python's reprlib library.

image

icecave/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

  • Thursday, February 5, 2015
  • by jmalloc
  • Repository
  • 2 Watchers
  • 11 Stars
  • 142,346 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

Repr

Build Status Code Coverage Latest Version, (*1)

Repr provides a way to generate informational string representations of any value, inspired by Python's reprlib library., (*2)

composer require icecave/repr

Example

Use the Repr::repr() method to obtain a string representation for any type., (*3)

use Icecave\Repr\Repr;

echo Repr::repr([1, 2, 3]);

The output from the example above is:, (*4)

[1, 2, 3]

Arrays

Arrays are represented using PHP 5.4 style short array notation. By default a maximum of 3 elements are shown along with a count of any additional elements. Nested arrays are represented up to 3 levels deep by default, with any arrays nested deeper than this showing only the element count., (*5)

Numeric Values

Numbers are represented naturally, floating point values will always display a decimal point even if representing a whole number., (*6)

Strings

Strings are represented enclosed in double quotes up to a default maximum length of 50 characters. Any control characters are shown as escape sequences., (*7)

Objects

Objects are represented as a class name and SPL object hash enclosed in angle brackets. If the object has a __toString method, the result of this is shown after the class name according to the rules of string representations specified above., (*8)

If an object implements RepresentableInterface, the result of its stringRepresentation() method is used instead., (*9)

Resources

Resources are represented as a resource type and ID enclosed in angle brackets. Stream resources will also display the stream mode., (*10)

Other Types

All other types are represented by the result of var_export() in lowercase., (*11)

The Versions

05/02 2015

dev-develop

dev-develop https://github.com/IcecaveStudios/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

string human readable representation repr

25/07 2014

dev-master

9999999-dev https://github.com/IcecaveStudios/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

string human readable representation repr

25/07 2014

1.0.1

1.0.1.0 https://github.com/IcecaveStudios/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

string human readable representation repr

11/01 2013

1.0.0

1.0.0.0 https://github.com/IcecaveStudios/repr

Human readable string representations of everything.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

string representation repr