Understanding Pluralization Rules

Problem

You want to know the best practices for pluralization.

You want to know the standard to follow for naming tables and objects.

Solution

Unfortunately, there is no one accepted way to do it.

Pick a standard for your application and stick with it. Some developers use singular forms for every thing with the justification that a table is really a single entity which holds multiple entities, thus you should refer to the User Table as a single concept, not the Users table.

Discussion

Laravel implements pluralized tables for singular models. In other words an object named User is stored in a table named users.

Following this same logic through, here are a few examples.

  • A "person" object - Person
  • Table full of Person objects - people
  • RESTful interface to the "person" object - api/people, api/people/{id}
  • A single order detail line object - "OrderDetail"
  • Table full of OrderDetail objects - order_details.
  • RESTful interface to Order Details - api/orders/{orderid}/details, api/orders/{orderid}/details/{id}
comments powered by Disqus