brick/varexporter
A powerful alternative to var_export(), which can export closures and objects without __set_state()
0.7.0
35M downloads/mo
#602 most downloaded on Packagist
brick/varexporter
What this package is like to depend on
Last release 7 months ago
06 Jan 2026
Release timing varies
gaps range from 2 weeks to 1.4 years
Nearly every release is documented
notes for 18 of 18 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
18 releases · first in 2019
1 release in the last 12 months
see the full history below
Release timeline
18 releases · Apr 2019 to Jan 2026Releases
latest 18-
0.7.006 Jan 2026Release notes
Open source →✨ New features
- Added
VarExporter::INLINE_LITERAL_LIST, similar toINLINE_SCALAR_LISTbut includes enum values
💥 BC breaks
- Minimum PHP version is now
8.2
Release notes
Open source →✨ New features
- Added
VarExporter::INLINE_LITERAL_LIST, similar toINLINE_SCALAR_LISTbut includes enum values
💥 BC breaks
- Minimum PHP version is now
8.2
- Added
-
0.6.020 Feb 2025Release notes
Open source →💥 BC breaks
- Minimum PHP version is now
8.1(#39)
✨ New features
- Support for exporting
matchconstructs in closures (#38)
Thanks to @reinfi!
Release notes
Open source →💥 BC breaks
- Minimum PHP version is now
8.1(#39)
✨ New features
- Support for exporting
matchconstructs in closures (#38)
Thanks to @reinfi!
- Minimum PHP version is now
-
0.5.010 May 2024Release notes
Open source →✨ Compatibility
- Added compatibility with
nikic/php-parser5.x - Removed compatibility with
nikic/php-parser4.x
💥 BC breaks
- deprecated constant
VarExporter::INLINE_NUMERIC_SCALAR_ARRAYhas been removed, please useINLINE_SCALAR_LISTinstead
Release notes
Open source →✨ Compatibility
- Added compatibility with
nikic/php-parser5.x - Removed compatibility with
nikic/php-parser4.x
💥 BC breaks
- deprecated constant
VarExporter::INLINE_NUMERIC_SCALAR_ARRAYhas been removed, please useINLINE_SCALAR_LISTinstead
- Added compatibility with
-
0.4.001 Sep 2023 -
0.3.821 Jan 2023Release notes
Open source →Release notes
Open source →✨ New feature
- Support for PHP 8.1
readonlyproperties (#27, #28)
Thanks @AnnaDamm!
- Support for PHP 8.1
-
0.3.729 Jun 2022Release notes
Open source →✨ New feature
- New option:
VarExporter::INLINE_ARRAY
🗑️ Deprecated
- The
VarExporter::INLINE_NUMERIC_SCALAR_ARRAYis deprecated, please useINLINE_SCALAR_LISTinstead
Release notes
Open source →✨ New feature
- New option:
VarExporter::INLINE_ARRAY
🗑️ Deprecated
- The
VarExporter::INLINE_NUMERIC_SCALAR_ARRAYis deprecated, please useINLINE_SCALAR_LISTinstead
- New option:
-
0.3.615 Jun 2022 -
0.3.510 Feb 2021Release notes
Open source →Release notes
Open source →✨ New feature
Support for controlling the base indentation level (#17).
Thanks @ADmad!
-
0.3.407 Feb 2021Release notes
Open source →✨ New feature
Support for trailing comma in non-inline arrays, with the
TRAILING_COMMA_IN_ARRAYflag (#16).Thanks @ADmad!
Release notes
Open source →✨ New feature
Support for trailing comma in non-inline arrays, with the
TRAILING_COMMA_IN_ARRAYflag (#16).Thanks @ADmad!
-
0.3.324 Dec 2020Release notes
Open source →🐛 Bug fix
- Exporting an object with numeric dynamic properties would lead to a
TypeError
Release notes
Open source →🐛 Bug fix
- Exporting an object with numeric dynamic properties would lead to a
TypeError
- Exporting an object with numeric dynamic properties would lead to a
-
0.3.213 Mar 2020Release notes
Open source →✨ New feature
Support for exporting internal classes implementing
__set_state():DateTimeDateTimeImmutableDateTimeZoneDateIntervalDatePeriod
Thanks @GameplayJDK!
-
0.3.123 Jan 2020Release notes
Open source →✨ New features
- Support for closures with
use()using theCLOSURE_SNAPSHOT_USEoption (#7) - Support for arrow functions in PHP 7.4 (#8)
Thanks to @jasny for his awesome work!
- Support for closures with
-
0.3.024 Dec 2019 -
0.2.116 Apr 2019Release notes
Open source →✨ New option:
VarExporter::INLINE_NUMERIC_SCALAR_ARRAY(#3)Formats numeric arrays containing only scalar values on a single line.
-
0.2.008 Apr 2019Release notes
Open source →✨ New feature
- Experimental support for closures 🎉
💥 Minor BC break
export()does not throw an exception anymore when encountering aClosure.
To get the old behaviour back, use theNO_CLOSURESoption.
-
0.1.208 Apr 2019Release notes
Open source →🐛 Bug fixes
- Static properties in custom classes were wrongly included—
unset()—in the output
✨ Improvements
- Circular references are now detected, and throw an
ExportExceptioninstead of erroring.
- Static properties in custom classes were wrongly included—
-
0.1.108 Apr 2019Release notes
Open source →🐛 Bug fixes
- Single-letter properties were wrongly exported using
->{'x'}notation.
✨ Improvements
-
Exception messages now contain the path (array keys / object properties) to the failure:
[foo][bar][0]Type "resource" is not supported.
- Single-letter properties were wrongly exported using
-
0.1.007 Apr 2019