Laravel Serializable Closure: serialize the unserializable @aarondfrancis
Laravel Serializable Closure: serialize the unserializable  @aarondfrancis
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
Laravel Serializable Closure: serialize the unserializableI made up this Laravel feature… then built itThe Music Makers Podcast - 011 - Dads: Be DoersCode tip: clean up after yourself (and a seltzer review)Distributed SQLite with Litestream and LiteFSSpeed up your Inertia.js website with these 7 tacticsThe Music Makers Podcast - 042 - Breaking the ChainThe Music Makers Podcast - 037 - The Top 5 Regrets of Dying PeopleI built a GUI in the terminal (with PHP)PHP on the frontend! No more Javascript!The Music Makers Podcast - 026 - The Finite, Irreplaceable Hours of Your LifeWelcome to Token Town
Aaron Francis |

Laravel Serializable Closure: serialize the unserializable

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER