laravel/serializable-closure
Securely serialize and unserialize PHP closures with Laravel’s fork of opis/closure 3.x, updated for modern PHP without requiring FFI. Wrap closures in SerializableClosure, set a secret key for signing, serialize safely, then restore with getClosure().
Adopt if:
opis/closure (avoiding FFI dependency).Look elsewhere if:
fn() => 1) and don’t need serialization.For Executives: "This package lets us safely serialize closures—think of them as 'lambdas in a bottle'—to cache complex logic, queue delayed tasks, or dynamically configure systems without rewriting code. It’s battle-tested by Laravel, supports modern PHP, and avoids risky FFI dependencies. For example, we could cache user-specific validation rules or queue background jobs with context-aware closures, cutting redundant computations and improving scalability. Low risk (MIT license, active maintenance), high reward for performance-critical paths."
For Engineers:
*"Laravel’s serializable-closure is a drop-in solution for serializing closures securely (with optional signing) and efficiently. Key benefits:
opis/closure to avoid FFI, with fixes for Laravel-specific edge cases (e.g., migrations, Bus::chain).SerializableClosure."*How can I help you explore Laravel packages today?