Hacking the Laravel router @aarondfrancis
Hacking the Laravel router  @aarondfrancis
Uploaded July 2025 | Updated September 2026, 1 hour ago
🚨 Unfortunately, this won't work when routes are cached.

We dive into the Laravel core and hack together a feature I’ve always wanted, route bindings that gracefully fall through if a model isn’t found. Along the way, I show how to safely extend Laravel with macros and custom validators without breaking future upgrades.

Check out Bento at: bentonow.com and be sure to sign up for my weekly newsletter at aaronfrancis.com/newsletter

Follow me:
Twitter: twitter.com/aarondfrancis
LinkedIn: linkedin.com/in/aarondfrancis
Website: aaronfrancis.com - find articles, podcasts, courses, and more.

Chapters:
00:00 - What we're building: Ignore missing bindings
01:42 - The feature idea: graceful fallthrough for bindings
04:47 - Source diving into Laravel to add a macro
05:52 - Storing custom route info in the action array
06:44 - How Laravel matches routes under the hood
07:57 - Planning the safest extension approach
09:06 - Writing a custom route validator
10:48 - Hooking our validator into Laravel’s matching process
12:03 - Understanding validators in Laravel routing
14:41 - Confirming our validator works
15:55 - How to substitute route bindings safely
17:17 - Mimicking Laravel’s binding behavior
19:03 - Handling model not found exceptions cleanly
21:10 - Verifying fall-through works for unknown routes
22:56 - Final test: podcasts and episodes working together
Hacking the Laravel routerWhat exactly is a Durable Object?The Music Makers Podcast - 019 - Work vs LifeSSG is dead. Long live cache.Programming by wishful thinkingOffline-first, multiplayer SQLiteLivecoding: create a podcast from YouTube videosOpen source workBuilding a new Laravel dev runner (as a TUI)Laravel Serializable Closure: serialize the unserializableI made up this Laravel feature… then built itThe Music Makers Podcast - 011 - Dads: Be Doers
Aaron Francis |

Hacking the Laravel router

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER