Appendix B. Zend Framework PHP Coding Standard

Table of Contents

B.1. Overview
B.1.1. Scope
B.1.2. Goals
B.2. PHP File Formatting
B.2.1. General
B.2.2. Indentation
B.2.3. Maximum Line Length
B.2.4. Line Termination
B.3. Naming Conventions
B.3.1. Classes
B.3.2. Interfaces
B.3.3. Filenames
B.3.4. Functions and Methods
B.3.5. Variables
B.3.6. Constants
B.4. Coding Style
B.4.1. PHP Code Demarcation
B.4.2. Strings
B.4.2.1. String Literals
B.4.2.2. String Literals Containing Apostrophes
B.4.2.3. Variable Substitution
B.4.2.4. String Concatenation
B.4.3. Arrays
B.4.3.1. Numerically Indexed Arrays
B.4.3.2. Associative Arrays
B.4.4. Classes
B.4.4.1. Class Declaration
B.4.4.2. Class Member Variables
B.4.5. Functions and Methods
B.4.5.1. Function and Method Declaration
B.4.5.2. Function and Method Usage
B.4.6. Control Statements
B.4.6.1. If / Else / Elseif
B.4.6.2. Switch
B.4.7. Inline Documentation
B.4.7.1. Documentation Format
B.4.7.2. Files
B.4.7.3. Classes
B.4.7.4. Functions

B.1. Overview

B.1.1. Scope

This document provides the code guidelines for developers and teams contributing to Zend Framework. The subjects covered are:

  • PHP File Formatting

  • Naming Conventions

  • Coding Style

  • Inline Documentation

B.1.2. Goals

Good coding standards are important in any development project, but particularly when multiple developers are working on the same project. Having coding standards helps ensure that the code is of high quality, has fewer bugs, and is easily maintained.