Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
This package has been abandoned. Use opis/closure instead.

jeremeamia/superclosure 1.0.0

Doing interesting things with closures like serialization and partial function application.
Package summary
Share
0
issues
0
licenses
Package created
21 Mar 2012
Version published
14 Jun 2013
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Error Generating Report

Frequently Asked Questions

What does jeremeamia/superclosure do?

The jeremeamia/superclosure is a highly functional PHP library that allows for the serialization of closures and anonymous functions. Despite PHP's default restrictions against serializing closures, the SuperClosure library makes this serialization not only possible but straightforward and efficient. Services such as Laravel, InterNations HTTP mock, Jumper and several others have incorporated SuperClosure into their projects.

How do you use jeremeamia/superclosure?

Making use of SuperClosure is pretty straightforward. First, you need to install the composer package using the command composer require jeremeamia/superclosure. Once installed, you can create a new object of Serializer class and call methods serialize and unserialize to serialize and unserialize closures. Here is an example:

use SuperClosure\Serializer;

$serializer = new Serializer();

$greeting = 'Hello';
$hello = function ($name = 'World') use ($greeting) {
    echo "{$greeting}, {$name}!\n";
};

$serialized = $serializer->serialize($hello);
$unserialized = $serializer->unserialize($serialized);

$unserialized('Jeremy');

In this example, $hello function is serialized and unserialized. After unserialization, it's called with the argument 'Jeremy'.

Where are the jeremeamia/superclosure docs?

The full documentation for the jeremeamia/superclosure package can be found in the README file on the GitHub repository page at https://github.com/jeremeamia/super_closure. The README contains detailed guidance on how to install and use the library, what features it supports, and known caveats to take into consideration when using the library. The examples of code usage are also provided.