Laravel Naming Conventions
Laravel is probably the most well-known PHP framework in the market today. It is used by thousands of companies and developers every day to develop all kinds of cool and exciting products.
This is why it is more important than ever to implement fairly strict naming conventions. Using naming conventions will help you and your team to keep your project and code consistent.
In this article I will cover common naming conventions for a Laravel project.

I have also included a short video explaining everything in this article.
Routes
- Routes consisting of a single word should be plural.
Good Example
Route::get('/posts')
Bad Example
Route::get('/post')
- Routes consisting of multiple words should be in ‘kebab-case’ and only the last word should be plural.
Good Example
Route::get('/blog-posts')
Bad Example
Route::get('/blogPost')
- Named Routes should be plural and ‘dot’ separated including the resource method.
Good Example
->name('posts.index')
Bad Example
->name('post.list')
Controllers
- Controllers should be ‘singular’ and in ‘PascalCase’, suffixed by the word ‘Controller’.
Good Example
PostController, BlogPostController
Bad Example
PostsController, blogPostsController
Models
- Models should be ‘singular’ and in ‘PascalCase’.
Good Example
Post, PostComment
Bad Example
Posts, PostComments
Methods (Functions) and Properties (Variables)
- Methods and Properties should be in ‘camelCase’.
Good Example
setPostName()
Bad Example
set_post_name()
Pivot Models
- Pivot models should be ‘singular’ and in ‘PascalCase’ and in ‘alphabetical’ order.
Good Example
PostTag
Bad Example
postsTags
Pivot Tables
- Pivot tables should be ‘singular’ and in ‘snake_case’ and in ‘alphabetical’ order.
Good Example
post_tag
Bad Example
PostsTags, postTags
Table Names
- Table names should be in ‘snake_case’ and the last word should be plural.
Good Example
posts, post_comments
Bad Example
post,PostComments, postComment
File Names (Including blade views)
- File names should be in ‘snake_case’ and this includes the ‘blade’ view files.
Good Example
active_users.blade.php
Bad Example
activeUsers.blade.php, active-users.blade.php
Configuration
- Configuration files should be in ‘snake_case’.
Good Example
utility_helper.php
Bad Example
utilityHelper.php, utility-helper.php
Policies
- Policies should be ‘singular’ and in ‘PascalCase’ (same as the Models) and suffixed with the word ‘Policy’.
Good Example
PostPolicy.php
Bad Example
postPolicies.php, Post-policy.php