A Laravel package providing an easy and secure way to serialize closures in PHP.
Laravel Serializable Closure is a PHP package that allows developers to serialize closures, enabling them to be stored in caches, databases, or transmitted across networks. It solves the problem that PHP's native serialization functions cannot handle closures, which is essential for frameworks like Laravel that use closures extensively. The package provides a secure method to serialize and unserialize closures while maintaining their functionality.
PHP developers, particularly those using the Laravel framework, who need to serialize closures for tasks like queued jobs, event handling, or caching.
Developers choose Laravel Serializable Closure because it offers a secure and easy-to-use solution for serializing closures without requiring the FFI extension, ensuring compatibility with standard web hosting environments. Its integration with Laravel and support for modern PHP versions make it a reliable choice for web applications.
Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports signing serialized closures with a secret key to prevent tampering, as shown in the README with SerializableClosure::setSecretKey('secret').
Avoids FFI dependency, making it compatible with standard PHP 7.4+ web environments where FFI is not typically enabled, as noted in the introduction.
Provides a simple API for serializing and unserializing closures with minimal code, exemplified by the concise usage example in the README.
Forked from the stable opis/closure 3.x series, ensuring reliability for Laravel applications without breaking changes from FFI-based updates.
Based on opis/closure 3.x, so it misses out on new features and optimizations from opis/closure 4.x, which uses FFI for better performance.
Explicitly not supported in REPL environments like Laravel Tinker, limiting use cases for development and debugging tools.
Caveats include problems with multiple closures on the same line, which may not be distinguishable after serialization, requiring careful code placement.