Skip to content

Code Conventions Style Guide

George Dawoud edited this page Apr 27, 2026 · 4 revisions

Code / Style Guide

API

The API is built with Slim version 4 (migrated from Slim 2.0 in the 7.x series). Route handlers live in src/api/routes/, src/admin/routes/, src/kiosk/routes/, and src/plugins/routes/.

Logging

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.

UI Standards

  • As of ChurchCRM 7.1, the UI uses Tabler built on Bootstrap 5. Before making UI changes, review the Tabler documentation and Bootstrap 5 documentation.
  • Use Tabler Icons (<i class="ti ti-{name}"></i>) throughout — do not add Font Awesome or other icon libraries.
  • Tabler ships many ready-made components (cards, tables, stats, offcanvas, modals). Check the Tabler docs before adding external components.
  • RTL layout is supported via Tabler's RTL build — no custom CSS overrides required.

⚠️ Do not use AdminLTE, Bootstrap 4, or jQuery-based patterns. Those were removed in 7.1.0.

General Code Formatting

  • 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.

Tabs and Indents

  • All tabs are represented as spaces
  • A single "tab" is expanded to 2 spaces

Alignment

A new line should follow the following clauses:

  • else
  • elseif
  • while
  • finally
  • catch

New lines should not follow class or scope definitions like "class", "public", or "private"

Braces

All open braces should be on the same line as the control statement:

  • Class definitions
  • Method declarations
  • if, else, elseif
  • for, foreach
  • while
  • do
  • switch
  • try, catch, finally

All close braces should be on their own line.

Spaces

A space should occur:

  • Inside the parentheses in the following statements:
    • if, elseif
    • for, foreach
    • while
    • catch
    • switch
  • Before and after the following elements:
    • Binary operators: < > ==
    • Ternary Operators: $b ? $a : $b
    • String Concatenation Operator: .
    • Key => Value Operator
    • Assignment Operator: $b = 5
  • After
    • Comma
    • Semicolon
    • Type-casts
    • Short PHP Tag
    • Before
    • Close PHP Tag

PHP Tags

  • We don't use PHP short tags
  • We do use <?= in place of <?php echo

Clone this wiki locally