Laravel Coding Best Practices — 01

Naming

camelCase — must start with a lowercase letter and the first letter of every new subsequent word has its first letter capitalized and is compounded with the previous word.

snake_case — replacing all spaces with a “_” and lowercasing all the words.

kebab-case — replacing all spaces with a “-” and lowercasing all the words.

PascalCase — every word starts with an uppercase letter

Laravel variable naming Conventions

Name should be singular and pascal case

Example :- UserController, PostController

Database tables

Name should be plural and snake case

Example :- users, user_posts

Table columns

Name should be singular and snake case

Example :- id, post_content, created_at

Variables

Name should be camelCase

Example :- $users, $usersPosts

Models

Name should be singular and pascal case

Example :- NewsPost, FormPost

Views

Name should be snake case

Example :- user_home.blade.php, all_post.blade.php

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store