Skip to content

Programming Style Guide

Esteban Alvarez Zuluaga edited this page Sep 6, 2025 · 16 revisions

PHP

Function, class and variable nomenclature

  • Functions and variables are to be specified in camelCase
  • Classes are to be specified in PascalCase
  • Constants and to be specified in all capital letters
  • Routes are to be defined in lowercase with different functionalities separated by "/" as in "controller/functionality", eg. "item/add"

Spacing and identantion

The project will use Laravel Pint as an automatic code styler for PHP code. Laravel Pint will ensure there is proper spacing and identation. To execute laravel Pint run:

./vendor/bin/pint

If Pint has not been downloaded, run:

composer require laravel/pint --dev

Laravel Pint uses standard PSR-12 for style in PHP. If formatting is carried out manually, refer to the PSR-12 guide.

HTML & CSS

We will use Google's HTML/CSS Style Guide for formatting raw HTML and CSS files. However, we will not use raw HTML and CSS, as most files will have Blade templating as well as HTML.

Summary

  • Two space identation (not tabs)
  • No trailing whitespace
  • Break lines at 80 characters
  • Lowercase HTML code
  • No mixing HTML, CSS, JavaScript

JavaScript

For any JavaScript code used in the project, stick to the same naming conventions as in PHP. For formatting functions, loops and control structures, refer to the following W3 School´s Guide.

For more detailed instructions on how to format a JavaScript file, refer to Google´s JavaScript Style Guide.

Blade

We will use Blade for templating wherever possible. Utilize existing templates, child templates and maintain consistency between views and templates used. Refer to the following guide for more information.

References

Clone this wiki locally