Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (34 sloc) 2.55 KB

Style guide for contributing


All PHP contributions must adhere to PSR-1 and PSR-2 specifications.

In addition:


  • All documentation blocks must adhere to the PHPDoc format and syntax.
  • All PHP files MUST contain the following documentation block immediately after the opening <?php tag:
 * UserFrosting Assets (
 * @link
 * @copyright Copyright (c) 2013-2019 Alexander Weissman, Jordan Mele
 * @license (MIT License)


  • All classes MUST be prefaced with a documentation block containing a description and the author(s) of that class. You SHOULD add other descriptive properties as well.
  • All class members and methods MUST be prefaced with a documentation block. Any parameters and return values MUST be documented.
  • The contents of a class should be organized in the following order: constants, member variables, constructor, other magic methods, public methods, protected methods, private methods.
  • Within each of the categories above, variables/methods should be alphabetized. See
  • Setter methods SHOULD return the parent object.


  • All class member variables and local variables MUST be declared in camelCase.


  • Array keys MUST be defined using snake_case. This is so they can be referenced in Twig and other templating languages.
  • Array keys MUST NOT contain .. This is because . is a reserved operator in Laravel and Twig's dot syntax.
  • Multidimensional arrays SHOULD be referenced using dot syntax whenever possible. So, instead of doing $myArray['person1']['email'], you should use $myArray[''] if your array structure supports it.

Automatically fixing coding style with PHP-CS-Fixer

PHP-CS-Fixer can be used to automatically fix PHP code styling. UserFrosting provides a project specific configuration file (.php_cs) with a set of rules reflecting our style guidelines. This tool should be used before submitting any code change to assure the style guidelines are met. Every sprinkles will also be parsed by the fixer.

PHP-CS-Fixer is automatically loaded by Composer and can be used from the UserFrosting root directory :

vendor/bin/php-cs-fixer fix
You can’t perform that action at this time.