When you are coding for the Zend Framework, or even with the Zend Framework, it is expected that you will follow certain guidelines. These are designed to make group projects easier. In other words, by defining coding conventions, you will not only avoid problems later but you will also make it easier for others to read your code. The Zend Framework documentation includes several pages of guidelines, including:
- Make sure the files are clean. In other words, no leading or trailing spaces that can call a web server to unexpectedly send content before headers, standard indents of four spaces, etc.
- Start your class name with
Zend_if and only if it is intended to be part of the Zend Framework itself, rather than just an application that uses the framework. - Underscores are forbidden in function names. Use camel-style lowercase (as in
getTodaysDate()), instead. - Start your variable names with an underscore only if they are private or protected.
- Declare all variables as private, protected, or public. Don’t use
var. - Use the standard PHP tag, as in
<?php ?>— not the short form (<? ?>). - Make sure your code is easy to read. In other words, when you use a period (
.) to concatenate text, be sure to put spaces before and after the period to make it more readable. The same holds for adding spaces after commas when declaring an array. - If you must pass-by reference, do it only in the declaration of a function. Call-time pass-by reference is prohibited.
- Every PHP file must include documentation that can be read by PhpDocumentor, and the coding guidelines specify certain minimum tags.
This is not a complete list of guidelines, of course, but it should give you an idea of the types of requirements. Check the documentation for the full list, so your code more easily fulfills the promise of making PHP projects easier to share.

