Registry / serialization / opis-closure

opis-closure

JSON →
library4.5.0phppackagistunverified

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

composer require opis/closure
INSTALL
IMPORT
SIG · OPIS-CLOSURE
O
opis-closure
serializationphpv4.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SerializableClosure
✓ use Opis\Closure\SerializableClosure;

Serialize and unserialize a closure

use Opis\Closure\SerializableClosure; $closure = function () { return 'hello'; }; $serialized = serialize(new SerializableClosure($closure)); $unserialized = unserialize($serialized)->getClosure(); echo $unserialized(); // hello
Debug
Known issues
breakingRequires PHP 7.4+ for arrow functions support
fix
Use PHP 7.4 or later
affects: >=4.0.0
Upgrade
Version history
4.5.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
opis-closure — pip install opis-closure · libregistry