Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zaster's avatar

Livewire Class Naming Convention

Laravel Models should be named as Singular

E.g.-

User
Item

Is it ok to name Livewire components as plural , such as

Items

I find it easy to make a selection between a Laravel Model and a Livewire Component Class

E.g.-

Item // Laravel Class
Items // Livewire Component Class

Or should i use Singular terms to name Livewire Component Classes ?

0 likes
5 replies
martinbean's avatar
Level 80

@zaster Use a name that makes sense and accurately describes what it is the class does. This same principle applies to any class, not just a Livewire component class.

A class name Items tells me nothing about the component. What type of items? What does it do with those items? Is it a form? A table? A list? Something else?

prospero's avatar

I think that in the most simple project you realize the your naming conventions must be use declarative. If you have different components using Item model, as full page or nested, what function does, maybe if you use controllers too for specific task...so, don't be determined in simplest name

muuucho's avatar

I also run into this problem. Lets say that I have a CRUD using a table named cars. It is likely that my corresponding model is named Cars. Let's then assume that I have a Livewire "Controller" that interacts between views and model with methods like Create, Update, Store, Deleted and so on. I like this file/class very much to be named Car as well. I am very tempted to use @zaster s naming rule here, which in this case results in Cars. Or maybe CarWire?

Snapey's avatar

@muuucho

It is likely that my corresponding model is named Cars

No, its likely that your model is (should) be Car as a model represents a SINGLE instance

Your livewire component should be like CarEditor or CarMaintenance or CarCrud or CarManager depending on if it is replacing a controller or is just providing a small piece of functionality

2 likes
muuucho's avatar

@Snapey Thanks. Of course, it is Car for the model. In this case, when I replace a crud controller, I will name my livewire component CarCrud.

Please or to participate in this conversation.