c. Code Conventions

The project utilizes Laravel's standard conventions.

Naming Conventions

ConventionDescription
VariablesCamel case (e.g., $myVariable)
Functions and MethodsCamel case (e.g., myFunction())
ClassesPascal case (e.g., MyClass)
ConstantsUppercase snake case (e.g., MY_CONSTANT)

Formatting Conventions

ConventionDescription
IndentationFour spaces for each level of indentation
BracesOpening braces on the same line as control structures and functions/methods; closing braces on a new line
Line LengthMaximum of 120 characters per line

Comments

ConventionDescription
Inline CommentsUse sparingly and only when necessary for clarification
Block CommentsUse to explain complex algorithms, functions, or sections of code

File Organization

ConventionDescription
Namespace DeclarationAt the top of the file after any import statements
Class DeclarationImmediately following the namespace declaration
Use StatementsAfter the namespace declaration, before the class declaration
File Extension.php for PHP files

Blade Files

ConventionDescription
HTML StructureFollow HTML5 standards and maintain consistent indentation and formatting
Blade DirectivesUse Laravel's Blade directives for control structures and data rendering
JavaScript
Naming ConventionsCamel case for variables and functions/methods; Pascal case for classes
FormattingUse consistent indentation and coding style; adhere to JavaScript best practices
HTML/CSS
Class NamingUse hyphen-separated lowercase for class names (e.g., sample-class)
ID NamingUse camel case for ID names (e.g., sampleId)

➡️ Next up!

d. UI Components

Built with LogoFlowershow Cloud