PackageTrack
Sign in Get early access

opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

4.5.0 238M downloads/mo #509 most downloaded on Packagist opis/closure

What this package is like to depend on

Last release 5 months ago

05 Mar 2026

Ships unpredictably

gaps range from 9 days to 2.9 years

Most releases are documented

notes for 58 of 65 stable releases

Nothing withdrawn

no release was ever pulled

13 years old

65 releases · first in 2014

2 releases in the last 12 months

see the full history below

Release timeline

65 releases · Feb 2014 to Mar 2026
2015 2017 2019 2021 2023 2025
Release Pre-release

Releases

latest 60 of 65
  1. 4.5.0 05 Mar 2026
    Release notes
    • Fixed nested re-serialization #163
    Open source →
    Release notes
    • Fixed nested re-serialization #163
    Open source →
  2. 4.4.0 20 Nov 2025
    Release notes
    • PHP 8.5 support (#162)
    Open source →
    Release notes
    • Add PHP 8.5 support #162
    Open source →
  3. 4.3.1 10 Jan 2025
    Release notes
    • Fixed reference bug #154
    Open source →
    Release notes
    • Fixed reference bug #154
    Open source →
  4. 4.3.0 08 Jan 2025
    Release notes
    • Proper serialization of private properties
    • Improved serialization/deserialization of properties having hooks (PHP 8.4)
    • Skip virtual properties (PHP 8.4)
    • Added Opis\Closure\clear_cache()
    • Added Opis\Closure\get_raw_properties()
    Open source →
    Release notes
    • Proper serialization of private properties
    • Improved serialization/deserialization of properties having hooks (PHP 8.4)
    • Skip virtual properties (PHP 8.4)
    • Added Opis\Closure\clear_cache()
    • Added Opis\Closure\get_raw_properties()
    Open source →
  5. 4.2.1 07 Jan 2025
    Release notes
    • Improved generic object serialization
    Open source →
    Release notes
    • Improved generic object serialization
    Open source →
  6. 4.2.0 07 Jan 2025
    Release notes
    • Added support for anonymous classes (also supports closures bound to anonymous classes)
    • Fixed closure scope for some edge cases
    • Improved parsers
    Open source →
    Release notes

    Changes

    • Added support for anonymous classes (also supports closures bound to anonymous classes)
    • Fixed closure scope for some edge cases
    • Improved parsers

    Internal changes

    Added classes

    • AbastractInfo
    • AbstractParser
    • AnonymousClassInfo
    • AnonymousClassParser
    • ReflectionClass
    • CodeStream

    Removed

    • ClosureStream (replaced by CodeStream)
    • ClassInfo (replace by ReflectionClass)
    Open source →
  7. 4.1.0 04 Jan 2025
    Release notes
    • Improved closure parser
    • Improved array & object serialization/unserialization
    • Added ClosureInfo::getClosure()
    • Fixed ClosureInfo::getFactory() bindings and marked the method as internal
    Open source →
    Release notes

    Changes

    • Improved closure parser
    • Improved array & object serialization/deserialization
    • Added ClosureInfo::getClosure()
    • Fixed ClosureInfo::getFactory() bindings and marked the method as internal

    Internal changes

    Added

    • ClassInfo::get()
    • ClassInfo::clear()
    • ClassInfo::isInternal()
    • ClassInfo::isEnum()
    • ClassInfo::refId()
    • ClassInfo is final
    • ClassInfo constructor is private

    Removed

    • Serializer::getClassInfo() (replaced by ClassInfo::get())
    • Serializer::isEnum() (replaced by ClassInfo::isEnum())
    Open source →
  8. 4.0.1 04 Jan 2025
    Release notes

    Fixes

    • unserialization cache error #149
    Open source →
    Release notes
    • Fixes unserialization error #149
    Open source →
  9. 4.0.0 28 Dec 2024
    Release notes
    • complete rewrite of the library
    • no dependencies
    • arbitrary data serialization
    • full PHP 8.x support
    Open source →
    Release notes
    • Complete rewrite of the library
    Open source →
  10. 3.7.0 08 Jul 2025
    Release notes
    • Fixed PHP 8.4 deprecations
    Open source →
  11. 3.6.3 27 Jan 2022

    Nothing published for this version

  12. 3.6.2 09 Apr 2021
    Release notes
    • Fixed string interpolation
    Open source →
  13. 3.6.1 07 Nov 2020
    Release notes
    • Fixed serialization error #84
    Open source →
  14. 3.6.0 11 Oct 2020
    Release notes
    • Initial PHP 8 Support #67.
    Open source →
  15. 3.5.7 06 Sep 2020
    Release notes
    • Fixed issue #76.
    • Fixed issue #78.
    Open source →
  16. 3.5.6 11 Aug 2020
    Release notes
    • Fixed issue #70
    Open source →
  17. 3.5.5 17 Jun 2020
    Release notes
    • Fixed a false-positive when using Opis\Closure\ReflectionClosure::isScopeRequired method
    Open source →
  18. 3.5.4 07 Jun 2020
    Release notes
    • Fixed a false-positive when using Opis\Closure\ReflectionClosure::isScopeRequired method
    • Fixed a bug related to T_STRING_VARNAME
    Open source →
  19. 3.5.3 25 May 2020
    Release notes
    • Improved parser
    • The 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 optimisation failed to work as expected and kept the wrong SerializableClosure scope.
    Open source →
  20. 3.5.2 21 May 2020
    Release notes
    • Removed extra semicolon in short closures, since is not part of the closure's body.
    Open source →
  21. 3.5.1 29 Nov 2019
    Release notes
    • Bugfix. See #47
    Open source →
  22. 3.5.0 29 Nov 2019
    Release notes
    • Added support for short closures (arrow functions)
    • Added isShortClosure method to Opis\Closure\ReflectionClosure
    Open source →
  23. 3.4.2 29 Nov 2019
    Release notes
    • Added stream_set_option()
    Open source →
  24. 3.4.1 19 Oct 2019
    Release notes
    • Fixed a bug that prevented serialization to work correctly.
    Open source →
  25. 3.4.0 02 Sep 2019
    Release notes
    • Added createClosure static method in Opis\Closure\SerializableClosure. This method creates a new closure from arbitrary code, emulating create_function, but without using eval
    Open source →
  26. 3.3.1 09 Jul 2019
    Release notes
    • Use sha1 instead of md5 for hashing file names in Opis\Closure\ReflectionClosure class
    Open source →
  27. 3.3.0 31 May 2019
    Release notes
    • Fixed a bug that prevented signed closures to properly work when the serialized string contains invalid UTF-8 chars. Starting with this version 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.
    Open source →
  28. 3.2.0 05 May 2019
    Release notes
    • 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 situation. Therefore, the Opis\Closure\SecurityException exception is no longer thrown when unserializing a signed closure, if no security provider is set.
    Open source →
  29. 3.1.6 22 Feb 2019
    Release notes
    • Fixed a bug that occurred when trying to set properties of classes that were not defined in user-land. Those properties are now ignored.
    Open source →
  30. 3.1.5 14 Jan 2019
    Release notes
    • Improved parser
    Open source →
  31. 3.1.4 14 Jan 2019
    Release notes
    • 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__(), etc.
    • Used @internal to mark classes & methods that are for internal use only and backward compatibility is not guaranteed.
    Open source →
  32. 3.1.3 06 Jan 2019
    Release notes
    • Fixed a bug that prevented traits to be correctly resolved when used by an anonymous class
    • Fixed a bug that occurred when $this keyword was used inside an anonymous class
    Open source →
  33. 3.1.2 16 Dec 2018
    Release notes
    • Fixed a bug regarding comma trail in group-use statements. See issue 23
    Open source →
  34. 3.1.1 02 Oct 2018
    Release notes
    • Fixed a bug where parent keyword was treated like a class-name and scope was not added to the serialized closure
    • Fixed a bug where return type was not properly handled for nested closures
    • Support for anonymous classes was improved
    Open source →
  35. 3.1.0 20 Sep 2018
    Release notes
    • Added transformUseVariables and resolveUseVariables to Opis\Closure\SerializableClosure class.
    • Added removeSecurityProvider static method to Opis\Closure\SerializableClosure class.
    • Fixed some security related issues where a user was able to unserialize an unsigned closure, even when a security provider was in use.
    Open source →
  36. 3.0.12 23 Feb 2018
    Release notes
    Open source →
  37. 3.0.11 21 Jan 2018
    Release notes
    Open source →
  38. 3.0.10 04 Jan 2018
    Release notes
    • Improved support for PHP 7.1 & 7.2
    Open source →
  39. 3.0.9 04 Jan 2018
    Release notes
    • Fixed a bug where the return type was not properly resolved. See issue 17
    • Added more tests
    Open source →
  40. 3.0.8 17 Dec 2017
    Release notes
    Open source →
  41. 3.0.7 31 Oct 2017
    Release notes
    • Bugfix: static properties are ignored now, since they are not serializable
    Open source →
  42. 3.0.6 06 Oct 2017
    Release notes
    • Fixed a bug introduced by accident in 3.0.5
    Open source →
  43. 3.0.5 18 Sep 2017
    Release notes
    • Fixed a bug related to nested references
    Open source →
  44. 3.0.4 18 Sep 2017
    Release notes
    • [internal] Refactored SerializableClosure::mapPointers method
    • [internal] Added a new optional argument to SerializableClosure::unwrapClosures
    • [internal] Removed SerializableClosure::getClosurePointer method
    • Fixed various bugs
    Open source →
  45. 3.0.3 06 Sep 2017
    Release notes
    • Fixed a bug related to nested object references
    • [internal] Opis\Closure\ClosureScope now extends SplObjectStorage
    • [internal] The storage property was removed from Opis\Closure\ClosureScope
    • [internal] The instances and objects properties were removed from Opis\Closure\ClosureContext
    Open source →
  46. 3.0.2 28 Aug 2017
    Release notes
    • Fixed a bug where $this object was not handled properly inside the SerializableClosre::serialize method.
    Open source →
  47. 3.0.1 13 Apr 2017
    Release notes
    • Fixed a bug in 'ignore_next' state
    Open source →
  48. 3.0.0 07 Apr 2017
    Release notes
    • Dropped PHP 5.3 support
    • Moved source files from lib to src folder
    • Removed second parameter from Opis\Closure\SerializableClosure::from method and from constructor
    • Removed Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure} classes
    • Refactored how signed closures were handled
    • Added wrapClosures and unwrapClosures static methods to Opis\Closure\SerializableClosure class
    • Added Opis\Colosure\serialize and Opis\Closure\unserialize functions
    • Improved serialization. You can now serialize arbitrary objects and the library will automatically wrap all closures
    Open source →
  49. 2.4.1 13 Apr 2017

    Nothing published for this version

  50. 2.4.0 16 Dec 2016
    Release notes
    • The parser was refactored and improved
    • Refactored Opis\Closure\SerializableClosure::__invoke method
    • Opis\Closure\{ISecurityProvider, SecurityProvider} were added
    • Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure} were deprecated and they will be removed in the next major version
    • setSecretKey and addSecurityProvider static methods were added to Opis\Closure\SerializableClosure
    Open source →
  51. 2.3.2 15 Dec 2016
    Release notes
    • Fixed a bug that prevented namespace resolution to be done properly
    Open source →
  52. 2.3.1 13 Dec 2016
    Release notes
    • Hotfix. See PR
    Open source →
  53. 2.3.0 17 Nov 2016
    Release notes
    • Added isBindingRequired and isScopeRequired to the Opis\Closure\ReflectionClosure class
    • Automatically detects when the scope and/or the bound object of a closure needs to be serialized.
    Open source →
  54. 2.2.1 20 Aug 2016
    Release notes
    • Fixed a bug in Opis\Closure\ReflectionClosure::fetchItems
    Open source →
  55. 2.2.0 26 Jul 2016
    Release notes
    • Fixed CS
    • Opis\Closure\ClosureContext, Opis\Closure\ClosureScope, Opis\Closure\SelfReference and Opis\Closure\SecurityException classes were moved into separate files
    • Added support for PHP7 syntax
    • Fixed some bugs in Opis\Closure\ReflectionClosure class
    • Improved closure parser
    • Added an analyzer for SuperClosure library
    Open source →
  56. 2.1.0 30 Sep 2015
    Release notes
    • Added support for the missing __METHOD__, __FUNCTION__ and __TRAIT__ magic constants
    • Added some security related classes and interfaces: Opis\Closure\SecurityProviderInterface, Opis\Closure\DefaultSecurityProvider, Opis\Closure\SecureClosure, Opis\Closure\SecurityException.
    • Fiexed a bug in Opis\Closure\ReflectionClosure::getClasses method
    • Other minor bugfixes
    • Added support for static closures
    • Added public isStatic method to Opis\Closure\ReflectionClosure class
    Open source →
  57. 2.0.1 23 Sep 2015
    Release notes
    • Removed branch-alias property from composer.json
    • Bugfix. See issue #6
    Open source →
  58. 2.0.0 30 Jul 2015
    Release notes
    • The closure parser was improved
    • Class names are now automatically resolved
    • Added support for the #trackme directive which allows tracking closure's residing source
    Open source →
  59. 1.3.0 18 Oct 2014
    Release notes
    • Added autoload file
    • Changed README file
    Open source →
  60. 1.2.2 04 Aug 2014
    Release notes
    • Started changelog
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive