This guide is based on PSR-1, the basic coding standard.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Overview
- Files MUST use only <?php and <?= tags.
Files MUST use only UTF-8 without BOM for PHP code.
Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both.
Namespaces and classes MUST follow an "autoloading" PSR: [PSR-0, PSR-4].
Class names MUST be declared in camelCase.
Class constants MUST be declared in all upper case with underscore separators.
- Method names MUST be declared in camelCase.
- Property names MUST be declared in camelCase.
PHP Tags
PHP code MUST use the long <?php ?>
tags and it MUST NOT use the short-echo <?= ?>
tags; it MUST NOT use the other tag variations. PHP code MUST include the opening and the closing tag.
Character Encoding
PHP code MUST use only UTF-8 without BOM.
Constants
Constants MUST be declared in camelCase.
Properties
Property names MUST be declared in camelCase.
Methods
Method names MUST be declared in camelCase()
.Die Coding Standards basieren vollständig auf den PSR-Standards.
Nummer | Titel | Symfony |
---|---|---|
PSR-1 | ||
PSR-2 | ||
PSR-3 | ||
PSR-4 | ||
PSR-6 | ||
PSR-12 | ||
PSR-14 |