c. Code Conventions
The project utilizes Laravel's standard conventions.
Naming Conventions
Convention | Description |
---|
Variables | Camel case (e.g., $myVariable ) |
Functions and Methods | Camel case (e.g., myFunction() ) |
Classes | Pascal case (e.g., MyClass ) |
Constants | Uppercase snake case (e.g., MY_CONSTANT ) |
Convention | Description |
---|
Indentation | Four spaces for each level of indentation |
Braces | Opening braces on the same line as control structures and functions/methods; closing braces on a new line |
Line Length | Maximum of 120 characters per line |
Convention | Description |
---|
Inline Comments | Use sparingly and only when necessary for clarification |
Block Comments | Use to explain complex algorithms, functions, or sections of code |
File Organization
Convention | Description |
---|
Namespace Declaration | At the top of the file after any import statements |
Class Declaration | Immediately following the namespace declaration |
Use Statements | After the namespace declaration, before the class declaration |
File Extension | .php for PHP files |
Blade Files
Convention | Description |
---|
HTML Structure | Follow HTML5 standards and maintain consistent indentation and formatting |
Blade Directives | Use Laravel's Blade directives for control structures and data rendering |
JavaScript | |
Naming Conventions | Camel case for variables and functions/methods; Pascal case for classes |
Formatting | Use consistent indentation and coding style; adhere to JavaScript best practices |
HTML/CSS | |
Class Naming | Use hyphen-separated lowercase for class names (e.g., sample-class) |
ID Naming | Use camel case for ID names (e.g., sampleId) |
➡️ Next up!
d. UI Components