Uploaded July 2025 | Updated September 2026, 1 hour ago
PHP doesn’t let you serialize closures, but Laravel does, thanks to an underrated package that’s built into the framework. I show you exactly how Laravel serializable-closure works, how Laravel uses it internally, and how you can use it safely (and securely!) in your own projects.
Check out Bento at: bentonow.com and be sure to sign up for my weekly newsletter at aaronfrancis.com/newsletter
GitHub repo: github.com/laravel/serializable-closure
Follow me:
Twitter: twitter.com/aarondfrancis
LinkedIn: linkedin.com/in/aarondfrancis
Website: aaronfrancis.com - find articles, podcasts, courses, and more.
Chapters:
00:00 - Why you can’t serialize closures in PHP
00:22 - Introducing Laravel Serializable Closure
01:12 - Don’t install it—Laravel already includes it
02:35 - Demonstrating the closure serialization problem
03:01 - What serialization means in PHP
04:47 - How unserialization works
05:20 - The problem with closures and serialization
05:36 - How Laravel makes closures serializable
08:03 - Bringing closures back to life
10:13 - How Laravel uses serializable closures
13:55 - How to sign a closure for security
15:01 - Preventing tampering with signed closures
16:30 - Why Laravel doesn’t always sign closures
17:28 - Wrapping up
PHP doesn’t let you serialize closures, but Laravel does, thanks to an underrated package that’s built into the framework. I show you exactly how Laravel serializable-closure works, how Laravel uses it internally, and how you can use it safely (and securely!) in your own projects.
Check out Bento at: bentonow.com and be sure to sign up for my weekly newsletter at aaronfrancis.com/newsletter
GitHub repo: github.com/laravel/serializable-closure
Follow me:
Twitter: twitter.com/aarondfrancis
LinkedIn: linkedin.com/in/aarondfrancis
Website: aaronfrancis.com - find articles, podcasts, courses, and more.
Chapters:
00:00 - Why you can’t serialize closures in PHP
00:22 - Introducing Laravel Serializable Closure
01:12 - Don’t install it—Laravel already includes it
02:35 - Demonstrating the closure serialization problem
03:01 - What serialization means in PHP
04:47 - How unserialization works
05:20 - The problem with closures and serialization
05:36 - How Laravel makes closures serializable
08:03 - Bringing closures back to life
10:13 - How Laravel uses serializable closures
13:55 - How to sign a closure for security
15:01 - Preventing tampering with signed closures
16:30 - Why Laravel doesn’t always sign closures
17:28 - Wrapping up










