NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #682 most downloaded on Packagist
Method redefinition (monkey-patching) functionality for PHP.
Latest stable
2.2.5
Last release 12 days ago
10 Nov 2026
Release timing varies
gaps range from 2 weeks to 1.1 years
Most releases are documented
notes for 38 of 58 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
58 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
Fix call_user_func of a static method in PHP 8.6 by @anomiex in https://github.com/antecedent/patchwork/pull/227
call_user_func of a static method in PHP 8.6 by @anomiex in https://github.com/antecedent/patchwork/pull/227Full Changelog: https://github.com/antecedent/patchwork/compare/2.2.4...2.2.5
PHP 8.6 | Tests: handle change in error message format by @jrfnl in #217
prependCodeToFunctions() by @antecedent in #214Full Changelog: 2.2.3...2.2.4
Your coding agent can read these notes before it upgrades. Set up the MCP server →
prependCodeToFunctions() by @antecedent in https://github.com/antecedent/patchwork/pull/214Full Changelog: https://github.com/antecedent/patchwork/compare/2.2.3...2.2.4
Fixed: PHP 8.5 | CallRerouting: Using null as an array offset is deprecated ( #179 , #180 )
Full Changelog: 2.2.2...2.2.3
PHP 8.5 | CallRerouting: prevent deprecation notice for Reflection*::setAccessible() by @jrfnl in #174
Full Changelog: 2.2.1...2.2.2
Full Changelog: https://github.com/antecedent/patchwork/compare/2.2.1...2.2.2
Fixed: PHP 8.4 deprecation notice regarding str_getcsv ( #170 by @kagg-design , #171 by @jrfnl )
str_getcsv (#170 by @kagg-design, #171 by @jrfnl)Full Changelog: 2.2.0...2.2.1
str_getcsv (#170 by @kagg-design, #171 by @jrfnl)Full Changelog: https://github.com/antecedent/patchwork/compare/2.2.0...2.2.1
PHP 8.4 | Silence deprecation for trigger_error() by @jrfnl in #161
E_STRICT from the tests by @jrfnl in #166E_STRICT by @jrfnl in #160Full Changelog: 2.1.28...2.2.0
E_STRICT from the tests by @jrfnl in https://github.com/antecedent/patchwork/pull/166E_STRICT by @jrfnl in https://github.com/antecedent/patchwork/pull/160Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.28...2.2.0
Handle anonymous class attribute by @romm in #152
Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.27...2.1.28
Issues #146 , #147 , and #148 , arising from updates to PHP's parser introduced in PHP 7.0 and not yet reflected in Patchwork's preprocessor, have bee
Full Changelog: 2.1.26...2.1.27
Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.26...2.1.27
Handle PHP 8.1 "never" return type by @anomiex in #141
Full Changelog: 2.1.25...2.1.26
Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.25...2.1.26
Fixed even more stream wrapper-related regressions that had appeared in 2.1.22.
Fixed even more stream wrapper-related regressions that had appeared in 2.1.22.
Full Changelog: 2.1.24...2.1.25
Fixed another regression introduced in 2.1.22 (Patchwork\CodeManipulation\Stream::dir_opendir)
Fixed another regression introduced in 2.1.22 (Patchwork\CodeManipulation\Stream::dir_opendir)
Full Changelog: 2.1.23...2.1.24
Fixed a regression from fixing #138 in 2.1.22.
Fixed a regression from fixing #138 in 2.1.22.
Full Changelog: 2.1.22...2.1.23
Fixed: Patchwork's stream wrapper fails to respect other stream wrappers
Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.21...2.1.22
Keep parenthesis around anonymous class parameters by @wvega in https://github.com/antecedent/patchwork/pull/128
Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.20...2.1.21
Fixed: #126 (new-keyword-redefinable causes a Fatal error: Uncaught ReflectionException: Class "*" does not exist in)
ramsey/composer-install by @jrfnl in https://github.com/antecedent/patchwork/pull/121Full Changelog: https://github.com/antecedent/patchwork/compare/2.1.19...2.1.20
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed #100, #102, #103, #104, #112. Merged #105, #106, #107, #108, #109, #110, #111, #113. Consequently, PHP 8 support should now be improved.
Fixed #100, #102, #103, #104, #112. Merged #105, #106, #107, #108, #109, #110, #111, #113. Consequently, PHP 8 support should now be improved.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Merged the proposed fixes for #90 and #91.
Merged the proposed fixes for #90 and #91.
Nothing published for this version
Nothing published for this version
To redefine class instantiations, {"new-keyword-redefinable": true} is now required in patchwork.json.
Fixed #73 and #74.
To redefine class instantiations, {"new-keyword-redefinable": true} is now required in patchwork.json.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed another bug that appeared in 2.1.1.
Fixed another bug that appeared in 2.1.1.
Fixed various bugs that appeared along with version 2.1.0.
Fixed various bugs that appeared along with version 2.1.0.
Class instantiations are now interceptable:
Class instantiations are now interceptable:
use function Patchwork\{redefine, always};
redefine('new PDO', always(new class extends PDO
{
public function query($sql)
{
echo $sql, PHP_EOL;
}
}));
Please note that void-typed functions are still not redefinable.
Second attempt to fix #64.
Please note that void-typed functions are still not redefinable.
As of now, void-typed functions and methods are not redefinable; support is coming in the next minor version.
Quick-fixed #64.
As of now, void-typed functions and methods are not redefinable; support is coming in the next minor version.
Nothing published for this version
Fixed: echo $var will no longer turn into a parse error when echo is in redefinable-internals.
Fixed: echo $var will no longer turn into a parse error when echo is in redefinable-internals.
Made most so-called language constructs redefinable, namely:
Made most so-called language constructs redefinable, namely:
echoprintevaldie and exitinclude and its variationscloneFixed #51, #52, #55 and DIRECTORY_SEPARATOR-related cache issues on Windows.
Fixed #51, #52, #55 and DIRECTORY_SEPARATOR-related cache issues on Windows.
Fixed #50 (2.0.2 was a failed attempt).
Fixed #50 (2.0.2 was a failed attempt).
Nothing published for this version
Nothing published for this version
Patchwork now supports the redefinition of internal functions.
Fixed: wildcard issues in HHVM due to the non-incremental ordering of get_declared_classes().
get_declared_classes().Patchwork\hasMissed($callable) : bool to check if your callable shows up too early to be redefinable.suppress-warnings key from patchwork.json, which is now redundant per previous point.Fixed: https://github.com/antecedent/patchwork/issues/37, https://github.com/antecedent/patchwork/issues/38
Fixed: Correctly handle class instances.
Added support for wildcards, e.g. redefine('App\*', ...).
redefine('App\*', ...).redefine became the preferred alias of replace.patchwork.json).Fixed previously faulty HHVM support. Possibly fixed: A conflict occurs between Patchwork and wincache PHP module.
Fixed previously faulty HHVM support. Possibly fixed: A conflict occurs between Patchwork and wincache PHP module.
Fixed: Apply scheduled patches only once.
Fixed: Fatal error: Generators cannot return values using "return".
Fixed: buggy reimplementation of binary search.
Patchwork\replaceLater is now a @deprecated alias to Patchwork\replace, which now performs an existence check when a redefinition is being undone, or…
Patchwork\callOriginal().Patchwork\replaceLater is now a @deprecated alias to Patchwork\replace, which now performs an existence check when a redefinition is being undone, or on shutdown.Fixed: Unexpected T_NS_SEPARATOR when using ::class syntax.
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.