terablaze/serializable-closure
Composer 安装命令:
composer require terablaze/serializable-closure
包简介
Terablaze Serializable Closure provides an easy and secure way to serialize closures in PHP.
README 文档
README
Introduction
This project is a fork laravel/serializable-closure package, which is a fork of the excellent opis/closure: 3.x package.
Terablaze Serializable Closure provides an easy and secure way to serialize closures in PHP.
Official Documentation
Installation
Requires PHP 7.4+
First, install Terablaze Serializable Closure via the Composer package manager:
composer require terablaze/serializable-closure
Usage
You may serialize a closure this way:
use Terablaze\SerializableClosure\SerializableClosure; $closure = fn () => 'james'; // Recommended SerializableClosure::setSecretKey('secret'); $serialized = serialize(new SerializableClosure($closure)); $closure = unserialize($serialized)->getClosure(); echo $closure(); // james;
Caveats
- Creating anonymous classes within closures is not supported.
- Using attributes within closures is not supported.
- Serializing closures on REPL environments such as Terablaze Repl is not supported.
License
Serializable Closure is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-20