I find routing in Laravel wonderful: it's easy to understand, structured yet highly configurable and flexible, and overall a pretty solid (pun intended) set of features. My only gripe with it is when it comes to defining and generating/using your actual routes.

And to top it all off - just imagine how many hard coded strings you'll have to change, once you eventually refactor your route definitions.

Neat, this checks all the boxes: No more hard coded strings, so our code is DRY and free of typos Our code is easy to modify without refactoring a bunch of files We get autocompletion from the IDE The code definition for a class with methods has much less cognitive complexity.

By now, I'm sure we're on the same page, why using hard coded strings for your route names isn't desirable.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners