Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here
Premium Members Only
Join to unlock this tutorial and all of our courses.
Tutorial Premium Tutorial

How to Name Things in Laravel

March 18, 2023
6 min read

How should you name your Controllers: singular or plural? With other similar questions, naming things consistently is important for code readability, compliance with standards, and avoiding errors. In this tutorial, we will cover a dozen tips for naming different things in Laravel and PHP, including Models, Controllers, Blade files, Migrations, and more.

Keep in mind that most of those are not strict rules, you can name things however you want, as long as it works. However, the problems with non-standard naming can be these:

  • You may need to write additional code to configure things to work properly
  • New developers on your team may need more time to understand the code
  • If things are named inconsistently, other developers need more brainpower/time to decide how to name things in their code
  • In some cases, it may even lead to bugs

So, I do encourage you to keep your code as close as possible to the standard naming conventions. Here are the examples.


How to Name Models in Laravel?

The rule of thumb in Laravel is to use a singular form for model names, like Book instead of Books.

This is because when you generate a model using php artisan make:model, Laravel assumes that the corresponding database table will be plural.

Using English words for naming is also...

Premium Members Only

This advanced tutorial is available exclusively to Laravel Daily Premium members.

Premium membership includes:

Access to all premium tutorials
Video and Text Courses
Private Discord Channel

Comments & Discussion

A
alvianm ✓ Link copied!

Great article!

HB
HISHAM BASHEER PANAYAM THODIKA ✓ Link copied!

hai, how to name multiple words for blade like "user settings"

M
Modestas ✓ Link copied!

userSettings - that would be my go-to

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.