Skip to content
forked from opis/closure

Serialize closures (anonymous functions)

License

Notifications You must be signed in to change notification settings

jeremeamia/closure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Opis Closure

Build Status Latest Stable Version Latest Unstable Version License

Serializable closures

Opis Closure is a library that aims to overcome PHP's limitations regarding closure serialization by providing a wrapper that will make the closure serializable.

The library's key features:

  • Serialize any closure
  • Doesn't use eval for closure serialization or unserialization
  • Works with any PHP version that has support for closures (Yes, even with PHP 5.3)
  • Handles all variables referenced/imported in use() and automatically wraps all referenced/imported closures for proper serialization
  • Handles recursive closures
  • Handles magic constants like __FILE__, __DIR__, __LINE__, __NAMESPACE__
  • Simple and very fast parser
  • Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly
  • You can serialize/unserialize any closure unlimited times, even those previously unserialized (this is possible because eval() is not used for unserialization)
  • Provides a reflector that can give you informations about closure code's, parameters, ...
  • Supports serialization of bounded objects and scopes (available only from PHP >= 5.4)

License

Opis Closure is licensed under the MIT License (MIT).

Requirements

  • PHP 5.3.* or higher

Installation

This library is available on Packagist and can be installed using Composer.

{
    "require": {
        "opis/closure": "1.3.*"
    }
}

If you are unable to use Composer you can download the tar.gz or the zip archive file, extract the content of the archive and include de autoload.php file into your project.

require_once 'path/to/closure-1.3.0/autoload.php';

Documentation

Examples and documentation can be found at http://opis.io/closure .

About

Serialize closures (anonymous functions)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%