Tim Williams
Aug 21, 2023

--

Interesting idea, but wasn't the idea of defining routes separate from controllers a deliberate move on Laravel's part? Earlier frameworks like Codeigniter did their routing by convention much like this, but newer systems like Laravel adopted a configuration based approach to solve some issues:

- Routing by convention is less secure. An attacker can essentially scan your system by testing different routes and getting an idea of your file structure.

- Routing by convention leaves less flexibility for where you apply your middleware. For instance, with Laravel's methodology many people apply their permissions middleware to the routing file, and leave the controller logic unmarred by that extra complication.

--

--

Tim Williams
Tim Williams

Written by Tim Williams

I am a Web Developer passionate about new technologies, as well as time tested best practices (here’s looking at you Uncle Bob).

Responses (1)