Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 30, 2024 via composer

opis/closure 3.6.3

A library that can be used to serialize closures (anonymous functions) and arbitrary objects.
Package summary
Share
0
issues
1
license
1
MIT
Package created
12 Feb 2014
Version published
27 Jan 2022
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
opis/closure@3.6.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of opis/closure 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does opis/closure do?

The Opis Closure library offers a solution to PHP's limitations when it comes to closure serialization. It simplifies the process, making all closures serializable while also allowing arbitrary object serialization. Key features of this library include, but are not limited, to: the ability to serialize any closure, handling recursive closures and magic constants, tracking closure's residing source, handling static closures, and support for cryptographically signed closures. It definitely adds a sophisticated touch to PHP programming, making it more efficient and flexible.

How do you use opis/closure?

Using the Opis Closure is fairly straightforward. Firstly, you will need to install the package, and this can be done by using the Composer from the command line interface:

composer require opis/closure

Alternatively, you can directly add it into your composer.json file as a dependency:

{
    "require": {
        "opis/closure": "^3.5"
    }
}

To utilize this library in your PHP script, you'll need to serialize and unserialize closures, like so:

use Opis\Closure\SerializableClosure;

$ser_closure = SerializableClosure::from(function($var){ echo $var; });
$serialized = serialize($ser_closure);
$unserialized = unserialize($serialized);

//Then call the unserialized closure
$unserialized('Hello World');

Please keep note to use this library with careful consideration, especially the Opis\Closure\serialize|unserialize functions because while the implementation is good, it is far from flawless.

Where are the opis/closure docs?

The full documentation for the Opis Closure library can be found on the Opis.io's official website, at the following link: Opis Closure Documentation. This online manual provides a comprehensive guide about how to integrate and efficiently use the library in your PHP projects, with additional tips and tricks for advanced usage.