NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #583 most downloaded on Packagist
A library that can be used to serialize closures (anonymous functions) and arbitrary data.
Last release 7 months ago
05 Mar 2026
Ships unpredictably
gaps range from 9 days to 2.9 years
Nearly every release is documented
notes for 58 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
65 releases · first in 2014
Fixed nested re-serialization #163
PHP 8.5 support
One column per quarter.
Fixed reference bug #154
Proper serialization of private properties
Opis\Closure\clear_cache()Opis\Closure\get_raw_properties()Improved generic object serialization
Added support for anonymous classes (also supports closures bound to anonymous classes)
Added classes
AbastractInfoAbstractParserAnonymousClassInfoAnonymousClassParserReflectionClassCodeStreamRemoved
ClosureStream (replaced by CodeStream)ClassInfo (replace by ReflectionClass)Improved array & object serialization/unserialization
ClosureInfo::getClosure()ClosureInfo::getFactory() bindings and marked the method as internalClosureInfo::getClosure()ClosureInfo::getFactory() bindings and marked the method as internalAdded
ClassInfo::get()ClassInfo::clear()ClassInfo::isInternal()ClassInfo::isEnum()ClassInfo::refId()ClassInfo is finalClassInfo constructor is privateRemoved
Serializer::getClassInfo() (replaced by ClassInfo::get())Serializer::isEnum() (replaced by ClassInfo::isEnum())unserialization cache error #149
Fixes
complete rewrite of the library
Fixed PHP 8.4 deprecations
Nothing published for this version
- Fixed string interpolation
- Fixed serialization error #84
- Initial PHP 8 Support #67.
- Fixed issue #76. - Fixed issue #78.
- Fixed issue #70
Fixed a false-positive when using Opis\Closure\ReflectionClosure::isScopeRequired method
Opis\Closure\ReflectionClosure::isScopeRequired methodFixed a false-positive when using Opis\Closure\ReflectionClosure::isScopeRequired method
Opis\Closure\ReflectionClosure::isScopeRequired methodT_STRING_VARNAMEThe class scope optimisation is no longer used. We always bind now to the closure's original class scope. When the class scope was null, the optimisat
null, the optimisation failed to work as expected and kept the wrong SerializableClosure scope.Removed extra semicolon in short closures, since is not part of the closure's body.
- Bugfix. See #47
Added support for short closures (arrow functions)
isShortClosure method to Opis\Closure\ReflectionClosure- Added stream_set_option()
stream_set_option()Fixed a bug that prevented serialization to work correctly.
Added createClosure static method in Opis\Closure\SerializableClosure. This method creates a new closure from arbitrary code, emulating create_functio
createClosure static method in Opis\Closure\SerializableClosure.
This method creates a new closure from arbitrary code, emulating create_function,
but without using evalUse sha1 instead of md5 for hashing file names in Opis\Closure\ReflectionClosure class
sha1 instead of md5 for hashing file names in Opis\Closure\ReflectionClosure classFixed a bug that prevented signed closures to properly work when the serialized string contains invalid UTF-8 chars. Starting with this version json_e
json_encode is no longer used
when signing a closure. Backward compatibility is maintained and all closures that were
previously signed using the old method will continue to work.Since an unsigned closure can be unserialized when no security provider is set, there is no reason to treat differently a signed closure in the same s
Opis\Closure\SecurityException exception is no longer thrown when
unserializing a signed closure, if no security provider is set.Fixed a bug that occurred when trying to set properties of classes that were not defined in user-land. Those properties are now ignored.
- Improved parser
Added support for static methods that are named using PHP keywords or magic constants. Ex: A::new(), A::use(), A::if(), A::function(), A::__DIR__(), e
A::new(), A::use(), A::if(), A::function(), A::__DIR__(), etc.@internal to mark classes & methods that are for internal use only and
backward compatibility is not guaranteed.Fixed a bug that prevented traits to be correctly resolved when used by an anonymous class
$this keyword was used inside an anonymous classFixed a bug regarding comma trail in group-use statements. See issue 23
Fixed a bug where parent keyword was treated like a class-name and scope was not added to the serialized closure
parent keyword was treated like a class-name and scope was not added to the
serialized closureAdded transformUseVariables and resolveUseVariables to Opis\Closure\SerializableClosure class.
transformUseVariables and resolveUseVariables to
Opis\Closure\SerializableClosure class.removeSecurityProvider static method to
Opis\Closure\SerializableClosure class.* Bugfix. See issue 20
* Bugfix. See issue 18
Improved support for PHP 7.1 & 7.2
Fixed a bug where the return type was not properly resolved. See issue 17
* Fixed a bug. See issue 16
Bugfix: static properties are ignored now, since they are not serializable
Fixed a bug introduced by accident in 3.0.5
Fixed a bug related to nested references
\[*internal*\] Refactored SerializableClosure::mapPointers method
SerializableClosure::mapPointers methodSerializableClosure::unwrapClosuresSerializableClosure::getClosurePointer methodFixed a bug related to nested object references
Opis\Closure\ClosureScope now extends SplObjectStoragestorage property was removed from Opis\Closure\ClosureScopeinstances and objects properties were removed from Opis\Closure\ClosureContextFixed a bug where $this object was not handled properly inside the SerializableClosre::serialize method.
$this object was not handled properly inside the
SerializableClosre::serialize method.Fixed a bug in 'ignore_next' state
Moved source files from lib to src folder
lib to src folderOpis\Closure\SerializableClosure::from method and from constructorOpis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure} classeswrapClosures and unwrapClosures static methods to Opis\Closure\SerializableClosure classOpis\Colosure\serialize and Opis\Closure\unserialize functionsNothing published for this version
Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure} were deprecated and they will be removed in the next major version
Opis\Closure\SerializableClosure::__invoke methodOpis\Closure\{ISecurityProvider, SecurityProvider} were addedOpis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure} were deprecated
and they will be removed in the next major versionsetSecretKey and addSecurityProvider static methods were added to Opis\Closure\SerializableClosureFixed a bug that prevented namespace resolution to be done properly
* Hotfix. See PR
Added isBindingRequired and isScopeRequired to the Opis\Closure\ReflectionClosure class
isBindingRequired and isScopeRequired to the Opis\Closure\ReflectionClosure classFixed a bug in Opis\Closure\ReflectionClosure::fetchItems
Opis\Closure\ReflectionClosure::fetchItemsOpis\Closure\ClosureContext, Opis\Closure\ClosureScope, Opis\Closure\SelfReference and Opis\Closure\SecurityException classes were moved into separate
Opis\Closure\ClosureContext, Opis\Closure\ClosureScope, Opis\Closure\SelfReference
and Opis\Closure\SecurityException classes were moved into separate filesOpis\Closure\ReflectionClosure classAdded support for the missing __METHOD__, __FUNCTION__ and __TRAIT__ magic constants
__METHOD__, __FUNCTION__ and __TRAIT__ magic constantsOpis\Closure\SecurityProviderInterface,
Opis\Closure\DefaultSecurityProvider, Opis\Closure\SecureClosure, Opis\Closure\SecurityException.Opis\Closure\ReflectionClosure::getClasses methodisStatic method to Opis\Closure\ReflectionClosure classRemoved branch-alias property from composer.json
branch-alias property from composer.jsonThe closure parser was improved
#trackme directive which allows tracking closure's residing source* Added autoload file * Changed README file
* Started changelog
Your coding agent can read these notes before it upgrades. Set up the MCP server →