brick/varexporter
Prettier, safer alternative to PHP var_export(). Exports variables as standalone executable PHP code (no runtime dependency) with short array syntax, cleaner numeric arrays, and support for closures and custom objects beyond __set_state(), ideal for fast OPcache-friendly caching.
β¨ New features
VarExporter::INLINE_LITERAL_LIST, similar to INLINE_SCALAR_LIST but includes enum valuesπ₯ BC breaks
8.2π₯ BC breaks
8.1 (#39)β¨ New features
match constructs in closures (#38)Thanks to @reinfi!
β¨ Compatibility
nikic/php-parser 5.xnikic/php-parser 4.xπ₯ BC breaks
VarExporter::INLINE_NUMERIC_SCALAR_ARRAY has been removed, please use INLINE_SCALAR_LIST insteadMinimum PHP version is now 7.4. No breaking changes.
β¨ New feature
VarExporter::INLINE_ARRAYποΈ Deprecated
VarExporter::INLINE_NUMERIC_SCALAR_ARRAY is deprecated, please use INLINE_SCALAR_LIST instead⨠New feature
Support for trailing comma in non-inline arrays, with the TRAILING_COMMA_IN_ARRAY flag (#16).
Thanks @ADmad!
π Bug fix
TypeError⨠New feature
Support for exporting internal classes implementing __set_state():
DateTimeDateTimeImmutableDateTimeZoneDateIntervalDatePeriodThanks @GameplayJDK!
β¨ New features
use() using the CLOSURE_SNAPSHOT_USE option (#7)Thanks to @jasny for his awesome work!
Minimum PHP version is now 7.2. No breaking changes.
β¨ New option: VarExporter::INLINE_NUMERIC_SCALAR_ARRAY (#3)
Formats numeric arrays containing only scalar values on a single line.
β¨ New feature
π₯ Minor BC break
export() does not throw an exception anymore when encountering a Closure.NO_CLOSURES option.π Bug fixes
unset()βin the outputβ¨ Improvements
ExportException instead of erroring.π Bug fixes
->{'x'} notation.β¨ Improvements
Exception messages now contain the path (array keys / object properties) to the failure:
[foo][bar][0]Type "resource" is not supported.
First release.
How can I help you explore Laravel packages today?