Joomla! Developer Network
The Joomla Coding Standards are based on the PEAR Coding Standards with some small variations as outlined below.
This page replaces and supersedes http://docs.joomla.org/Coding_style_and_standards in the Docs wiki.
Indenting and Line Length
http://pear.php.net/manual/en/standards.indenting.php
Note that Joomla uses real tabs instead of spaces for indents.
The is no set maximum on line length but a notional value of about 125 characters is recommended.
Control Structures
http://pear.php.net/manual/en/standards.control.php
The guidelines for formatting control structures is observed. When indenting switch statements, Joomla uses an additional indent of the case structures which is optionally allowed.
Function Calls
http://pear.php.net/manual/en/standards.funcalls.php
Class Definitions
http://pear.php.net/manual/en/standards.classdef.php
Function Definitions
http://pear.php.net/manual/en/standards.funcdef.php
Arrays
http://pear.php.net/manual/en/standards.arrays.php
Comments
http://pear.php.net/manual/en/standards.comments.php
Perl style # comments are not permitted in Joomla.
Including Code
http://pear.php.net/manual/en/standards.including.php
PHP Code Tags
http://pear.php.net/manual/en/standards.tags.php
Header Comment Blocks
http://pear.php.net/manual/en/standards.header.php
The PHP version comments is not required in Joomla.
@link is an optional tag in the Joomla source code.
@author is not used in the Joomla source code except when using an external library that has been included.
@copyright is a required tag in the Joomla source code.
@package_version@ is not used in Joomla.
Using SVN
http://pear.php.net/manual/en/standards.svn.php
The $Id$ keyword is to be used in all PHP, XML, CSS and JS files and the accompanying svn:keywords property should be set.
The svn:eol-style should be set to LF.
Joomla does not use any other tags.
Naming Conversions
http://pear.php.net/manual/en/standards.naming.php
Joomla does not use underscore separator in class or function names.
TODO: Explain the naming convention that JLoader supports.
File Formats
http://pear.php.net/manual/en/standards.file.php
Joomla source code file encoding must be UTF-8 only.
The closing ?> PHP tag should not be included to prevent the accidental introduction of whitespace prior to the session being created.
E_STRICT Compatible Code
http://pear.php.net/manual/en/standards.e_strict.php
Joomla is committed to progressively making the source code E_STRICT.
Error Handling Guidelines
http://pear.php.net/manual/en/standards.errors.php
The PEAR standard is not applicable to Joomla.
TODO: Define the Joomla standards for throwing exceptions and raising errors.
