2017-25 © Pedro Peláez
 

library closure

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

image

opis/closure

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

  • Wednesday, May 23, 2018
  • by msarca
  • Repository
  • 18 Watchers
  • 204 Stars
  • 234,208 Installations
  • PHP
  • 38 Dependents
  • 4 Suggesters
  • 9 Forks
  • 0 Open issues
  • 37 Versions
  • 19 % Grown

The README.md

Opis Closure

Tests Packagist Version Packagist Downloads Packagist License, (*1)

Serialize closures, serialize anything

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

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

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

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

[!IMPORTANT] Starting with version 4.2, Opis Closure supports serialization of anonymous classes., (*3)

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!

A full rewrite was necessary to keep this project compatible with the PHP's new features, such as attributes, enums, read-only properties, named parameters, anonymous classes, and so on. This wasn't an easy task, as the latest attempt to launch a 4.x version involved using the FFI extension in exotic ways, and it failed hard. The main problem was that very often the closures were bound to some object, thus in order to preserve functionality, we had to serialize the object too. Since we had to do arbitrary data serialization, we decided to make this project about arbitrary data serialization, providing support for serializing closures but also adding more effortless ways to serialize custom objects., (*4)

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., (*5)

Documentation

The full documentation for this library can be found here., (*6)

License

Opis Closure is licensed under the MIT License (MIT)., (*7)

Requirements

  • PHP >= 8.0

Installation

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

composer require opis/closure

Or you could directly reference it into your composer.json file as a dependency, (*9)

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

The Versions

23/05 2018

dev-master

9999999-dev http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

23/02 2018

3.0.12

3.0.12.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

22/01 2018

3.0.11

3.0.11.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

04/01 2018

3.0.10

3.0.10.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

04/01 2018

3.0.9

3.0.9.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

18/12 2017

3.0.8

3.0.8.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

31/10 2017

3.0.7

3.0.7.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

06/10 2017

3.0.6

3.0.6.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

18/09 2017

3.0.5

3.0.5.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

18/09 2017

3.0.4

3.0.4.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

06/09 2017

3.0.3

3.0.3.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

28/08 2017

3.0.2

3.0.2.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

13/04 2017

3.0.1

3.0.1.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

13/04 2017

2.4.x-dev

2.4.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

13/04 2017

2.4.1

2.4.1.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

07/04 2017

3.0.0

3.0.0.0 http://www.opis.io/closure

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

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

25/01 2017

3.0.x-dev

3.0.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

16/12 2016

2.4.0

2.4.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

15/12 2016

2.3.x-dev

2.3.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

15/12 2016

2.3.2

2.3.2.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

13/12 2016

2.3.1

2.3.1.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

17/11 2016

2.3.0

2.3.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

20/08 2016

2.2.x-dev

2.2.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

20/08 2016

2.2.1

2.2.1.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

26/07 2016

2.2.0

2.2.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

30/09 2015

2.1.x-dev

2.1.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

30/09 2015

2.1.0

2.1.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

23/09 2015

2.0.1

2.0.1.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

31/07 2015

2.0.0

2.0.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

30/07 2015

1.3.x-dev

1.3.9999999.9999999-dev http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

18/10 2014

1.3.0

1.3.0.0 http://www.opis.io/closure

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

04/08 2014

1.2.2

1.2.2.0 http://opis.io

A library for PHP 5.3+ that can be used to serialize closures (anonymous functions).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable anonymous functions

16/02 2014

1.2.1

1.2.1.0 http://opis.io

A PHP 5.3+ library for closure serialization. Serialize any closure in a safe and fast way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable

16/02 2014

1.2.0

1.2.0.0 http://opis.io

A PHP 5.3+ library for closure serialization. Serialize any closure in a safe and fast way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization serialize closure serializable

15/02 2014

1.1.1

1.1.1.0 http://opis.io

Real serialization of closures is now possible. Serialize any closure in a safe and fast way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization closure opis

14/02 2014

1.1.0

1.1.0.0 http://opis.io

Real serialization of closures is now possible. Serialize any closure in a safe and fast way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization closure opis

12/02 2014

1.0.0

1.0.0.0 http://opis.io

Real serialization of closures is now possible. Serialize any closure in a safe and fast way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Marius Sarca

function serialization closure opis