var_representation

A compact, more readable alternative to var_export.


var_representation is a compact alternative to var_export that properly escapes control characters

License: BSD-3-Clause

Latest releases

Version Release Download
0.1.5 2024-08-11 var_representation-0.1.5.tgz
0.1.4 2022-10-16 var_representation-0.1.4.tgz
0.1.3 2022-10-14 var_representation-0.1.3.tgz
0.1.2 2022-08-31 var_representation-0.1.2.tgz
0.1.1 2021-08-14 var_representation-0.1.1.tgz
Show all releases

Changelog

Version Message
0.1.5 * Properly use the getters of php 8.4 hooked properties the same way as var_export.
0.1.4 * No code changes.
* Adds steps to build DLLs for Windows in CI.
0.1.3 * Fix improper detection of VAR_REPRESENTATION_UNESCAPED flag. The var_representation function was previously checking for VAR_REPRESENTATION_SINGLE_LINE due to missing parenthesis in a bitwise operation.
0.1.2 * Switch from infinite recursion detection on the object's properties to infinite recursion detection on the object itself.
This conforms with the change to var_export/debug_zval_dump in php 8.2-dev,
and would allow data structures to safely start returning temporary arrays that can be garbage collected to save memory
(after dumping the representation) starting in php 8.2+.
0.1.1 * Optimize escaping single quoted strings
* Add a new flag VAR_REPRESENTATION_UNESCAPED to always encode strings as single quoted strings without escaping control characters.
This may be useful when the result of var_representation is escaped again before being rendered (e.g. json encoding),
or when a short representation is desired.
Show complete changelog