grasmash/expander
Expands internal property references in PHP arrays.
4.0.0
67M downloads/mo
#592 most downloaded on Packagist
grasmash/expander
What this package is like to depend on
Last release 2 months ago
11 Jun 2026
Release timing varies
gaps range from 2 weeks to 2.5 years
Some releases are documented
notes for 4 of 8 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
9 releases · first in 2017
1 release in the last 12 months
see the full history below
Release timeline
9 releases · Dec 2017 to Jun 2026Releases
latest 9-
4.0.011 Jun 2026Release notes
Open source →What's new in 4.0
Major modernization release. Requires PHP 8.2+.
Bug and security fixes
- Fixed memory-exhaustion DoS: circular property references with surrounding text (e.g.
['a' => 'x${b}', 'b' => 'y${a}']) previously grew unboundedly until the process crashed. Expansion is now capped at 25 passes / 1 MiB per value. ${env.*}placeholders no longer readHTTP_*keys from$_SERVER— in a web context those originate from client-supplied request headers, not the environment.- Falsy environment variables now expand:
VAR=0previously failed a truthiness check and left the placeholder unexpanded. - Type preservation in reference-data mode: booleans, integers, and floats expanded via a reference array previously coerced to strings (
truebecame"1"). Types are now preserved. - Single-placeholder strings are expanded once instead of twice, eliminating duplicate logger and stringifier side effects.
- A PCRE failure during replacement now restores the original value instead of nulling it.
Breaking changes
- PHP 8.2+ is required.
- All source files declare
strict_types=1, with full parameter and return type declarations. StringifierInterface::stringifyArray()is now an instance method rather than a static method. Custom implementations and static callers must update.Expander::expandArrayProperties()requires$reference_arrayto be an array.Expander::expandPropertyWithReferenceData()returnsmixedinstead of?string.
Tooling
- PHPUnit
^10.5 || ^11 || ^12 || ^13, phpstan level 5, PHP_CodeSniffer^3.13 || ^4.0. - CI matrix covers PHP 8.2, 8.3, 8.4, and 8.5, with a
composer auditstep. - 100% line, method, and class test coverage.
- Dependabot keeps composer and GitHub Actions dependencies current.
Full changelog: 3.0.1...4.0.0
- Fixed memory-exhaustion DoS: circular property references with surrounding text (e.g.
-
3.0.125 Nov 2024 -
3.0.010 May 2022 -
2.0.325 Apr 2022Nothing published for this version
-
2.0.224 Feb 2022Nothing published for this version
-
2.0.119 Feb 2022Release notes
Open source →What's Changed
- Fixes #9: Use $_SERVER instead of $_ENV for greater reliability. by @greg-1-anderson in #13
Full Changelog: 2.0.0...2.0.1
-
2.0.008 Dec 2021Nothing published for this version
-
2.0.0-beta117 Aug 2019 pre-release -
1.0.021 Dec 2017Nothing published for this version