Repository navigation
Programming Style Guide
- 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"
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.
Laravel Pint is to be used frequently in the development cycle, ideally before every commit to ensure that there is always good code styling.
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.
- Two space indentation (not tabs)
- No trailing whitespace
- Break lines at 80 characters
- Lowercase HTML code
- No mixing HTML, CSS, 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.
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.
- https://www.php-fig.org/psr/psr-12/
- https://google.github.io/styleguide/htmlcssguide.html
- https://www.freecodecamp.org/news/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-whats-the-difference/
- https://laravel.com/docs/12.x/blade
- https://w3schools.tech/tutorial/laravel/laravel_blade_templates
- https://www.w3schools.com/js/js_conventions.asp
- https://codiepp.github.io/styleguide/jsguide.html#:~:text=This%20document%20serves%20as%20the%20complete%20definition%20of,only%20if%20it%20adheres%20to%20the%20rules%20herein.