Download the PHP package simivar/reverse-print-r without Composer
On this page you can find all versions of the php package simivar/reverse-print-r. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simivar/reverse-print-r
More information about simivar/reverse-print-r
Files in simivar/reverse-print-r
Package reverse-print-r
Short Description Library to reverse print_r output to PHP objects, arrays and scalar values.
License MIT
Informations about the package reverse-print-r
Reverse print_r
This library provides six different handlers for reversing output of PHP's print_r
function back to original variables.
If there's no handler available for a type it's returned as string
.
Assumptions
- all values should be type-casted, not returned as
string
- empty string (
""
) is treated asnull
(seeNullHandler
) - integers are treated as integers (no
boolean
support) - multi-level
array
MUST be supported with type-casting public
,protected
andprivate
properties of Objects MUST be supported with type-casting
Known issues
- no support for Object Inheritance
Installation
Package is available via Composer.
Usage
Changing behavior of Handlers
All handlers are defined as final
, but thanks to Dependency Injection it's easy to change the behavior of library
and it's type-casting. Let's say you want to keep all the empty strings ""
as string, not null
. All you have to do
is create your own HandlerRunner
without NullHandler
.
Own Handlers
The same way to removed NullHandler
you can add your own handlers. All you have to do is make sure that it implements
\ReversePrintR\Handler\HandlerInterface
and you are good to go.
Versioning
Library is following Semver. All minor and patch updates are backwards compatible.
License
Please see the license file for more information.