承接 opis/closure 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

opis/closure

最新稳定版本:4.4.0

Composer 安装命令:

composer require opis/closure

包简介

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

README 文档

README

Tests Packagist Version Packagist Downloads Packagist License

Serialize closures and anonymous classes

Opis Closure is a PHP library that allows you to serialize closures, anonymous classes, and arbitrary data.

Key features:

Example of closure serialization

use function Opis\Closure\{serialize, unserialize};

$serialized = serialize(fn() => "hello from closure!");
$greet = unserialize($serialized);

echo $greet(); // hello from closure!

Example of anonymous class serialization

use function Opis\Closure\{serialize, unserialize};

$serialized = serialize(new class("hello from anonymous class!") {
    public function __construct(private string $message) {}
    
    public function greet(): string {
        return $this->message;
    }
});

$object = unserialize($serialized);
echo $object->greet(); // hello from anonymous class!

Migrating from 3.x

Version 4.x is a full rewrite of the library, but data deserialization from 3.x is possible. Read the docs on how to migrate from 3.x.

Documentation

The full documentation for this library can be found here.

License

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

Requirements

  • PHP >= 8.0

Installation

Opis Closure is available on Packagist, and it can be installed from a command line interface by using Composer:

composer require opis/closure

Or you could directly reference it into your composer.json file as a dependency

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

统计信息

  • 总下载量: 226.08M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2575
  • 点击次数: 3
  • 依赖项目数: 319
  • 推荐数: 13

GitHub 信息

  • Stars: 2560
  • Watchers: 24
  • Forks: 93
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固