emirk's avatar
Level 2

Laravel naming conventions

Hello, while I was reading the Laravel 5.4 docs, I have realized that for controllers the naming convention is in singular but it was in plural so far, so it made me a little puzzled, because for me it is really bad idea to change those essential things relatively quick...

So, can someone tell me what are the naming convetions for:

  • Controllers
  • Views
  • Traits
0 likes
3 replies
mstnorris's avatar

It's whatever you want it to be.

For me, controllers are singular (matching the models), for example:

Model - Event

Controller - EventController

Views - events/index, events/show etc

Traits - whatever makes sense and is more readable

1 like
jlrdw's avatar

I'd stick to the naming conventions in the docs, examples, and videos there you can't go wrong.

1 like

Please or to participate in this conversation.