-
Notifications
You must be signed in to change notification settings - Fork 498
Code Conventions Style Guide
Robert Spencer edited this page May 10, 2024
·
3 revisions
The API is built with Slim version 2.0
We are using Monolog for logging. In Standard pages we have $logger var that can be used if the debug is enabled in the System Settings. In the Slim APIs you can use $this->Logger-> var.
- We use the AdminLTE theme to generate a consistent UX for our users. Before you make any UI changes please review the AdminLTE documentation for the best way to leverage the theme's built in JavaScript and CSS.
- AdminLTE contains many JavaScript Plugins (including JQuery and Bootstrap), so before adding any external components, please evaluate the plugins already in the project.
- We use editorconfig to normalize code styling.
- Not all code styles are supported for normalization within editorconfig, so please refer to the list below
- All files use LF (Unix) line endings. CI Tests will fail for any PR containing CRLF or CR line endings.
- All tabs are represented as spaces
- A single "tab" is expanded to 2 spaces
A new line should follow the following clauses:
elseelseifwhilefinallycatch
New lines should not follow class or scope definitions like "class", "public", or "private"
All open braces should be on the same line as the control statement:
- Class definitions
- Method declarations
-
if,else,elseif -
for,foreach whiledoswitch-
try,catch,finally
All close braces should be on their own line.
A space should occur:
- Inside the parentheses in the following statements:
-
if,elseif -
for,foreach whilecatchswitch
-
- Before and after the following elements:
- Binary operators:
< > == - Ternary Operators:
$b ? $a : $b - String Concatenation Operator:
. - Key
=>Value Operator - Assignment Operator:
$b = 5
- Binary operators:
- After
- Comma
- Semicolon
- Type-casts
- Short PHP Tag
- Before
- Close PHP Tag
- We don't use PHP short tags
- We do use
<?=in place of<?php echo
- Installation Guide ← Start here!
- First Run Setup
- Features Overview
- Upgrade Guide
- Backup & Restore
- Rollback Procedures
- File Permissions
- Troubleshooting
- Logging & Diagnostics
- SSL/HTTPS Security
- Localization