Package
Laravel Serializable Closure
Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
Overview
What Laravel Serializable Closure does
Laravel Serializable Closure offers a secure method to serialize closures in PHP, accommodating changes from the new opis/closure version.
The package was born from the need to handle closures without the PHP FFI extension, which is not typically activated in web requests. This became necessary as the opis/closure library, widely used for this purpose, introduced a complete rewrite reliant on FFI for its new version. Laravel's fork maintains compatibility and ensures continued functionality within its framework.
For developers working with Laravel, serializing closures can be streamlined using this tool. By wrapping a closure in the SerializableClosure class, it becomes straightforward to serialize and unserialize closures, maintaining their integrity and functionality. This can be especially useful in scenarios where closures need to be persisted or sent across network boundaries.
Laravel Serializable Closure does have some limitations; it doesn’t support REPL environments like Laravel Tinker, and multiple closures on the same source line might not serialize uniquely. Despite these caveats, it offers a robust solution for applications needing to serialize closures in environments without the FFI dependency.
This overview was generated by AI from the package README and may not reflect the latest release.
Read the full README →