Laracon 2024: Luke Downing: Lessons From the Framework

Luke Downing gave a great talk about lessons you can learn from the framework.

He took us line-by-line through routes/web.php (from the app structure prior to Laravel 11), explaining all the things you can learn from that file:

  • Authorization: the app has users, allows registration and login, etc. and uses one of the Laravel authentication starter kits
  • Model relationships: nested resource routes indicate that other models belong to users, and while the public can view models, only users can edit them
  • and more

I’ve found the routes files to be extremely helpful in my day-to-day development. In fact, I usually add the routes file as a pinned tab in VS Code so it’s always open (depending on the app, sometimes web.php, sometimes api.php, and sometimes both).

Some quotes from the talk:

Ordinary and obvious, not clever and convoluted.

The more obvious and clear your code is, the easier it is to spot and prevent bugs, and the simpler it is to come back to it later.

Know the rules and when to break them.

e.g., using facades for simpler testing, instead of the “right way” of dependency injection

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.