Skip to content

Programming Style Guide

Esteban Alvarez Zuluaga edited this page Nov 10, 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 indentation

The project will use Laravel Pint as an automatic code styler for PHP code. Laravel Pint will ensure there is proper spacing and indentation. Laravel Pint must be run before every commit. To execute Laravel Pint, in the terminal run:

./vendor/bin/pint

Laravel Pint uses standard PSR-12 for style in PHP. For more information, refer to the PSR-12 guide.

When to use Laravel Pint

Laravel Pint is to be used frequently in the development cycle, ideally before every commit to ensure that there is always good code styling.

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 indentation (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