Starting with version 184.108.40.206, the PrestaShop Core codebase has switched to the PSR-1 coding standard and PSR-2 coding style guide. See the reasons why on the announcement article on the Build PrestaShop deblog.
Existing modules and themes are not required to switch to PSR-1 and PSR-2.
If you want to update your PHP code to the PSR-1 and PSR-2 guidelines, you can use the PHP Coding Standards Fixer, which fixes most issues automatically.
For reference's sake, the old PrestaShop coding standards is kept in this page: Pre-220.127.116.11 PHP Coding Standards. Please do not use it anymore!
|As of May 10th, 2016, our chosen standards were further detailed. Read the announcement article.|
Here are the standards, conventions and guidelines that we choose to follow as of May 5th 10th, 2016 (for PrestaShop 18.104.22.168+ and PrestaShop 1.7):
- PHP : code
We keep PSR-1 and PSR-2, along with a few nice details from Symfony.
- HTML & CSS : code
We choose to follow the Mark Otto's coding standards. Mark is the creator of the Bootstrap framework.
- Smarty / Twig : code
Same standards as with HTML & CSS.
- Commits & Pull-requests : conventions
We choose to formalize best practices.
- SQL : same guidelines
Same as before.
About the code validator (PHP CodeSniffer)