Gmail Calendar Documents Reader Web more »
Help | Sign in
Google Groups Home
Group info
Members: 25
Group categories: Not categorized
More group info »
Recent pages and files
PHP Coding Standard    

Coding standard for PHP 5.3 and above.

Namespaces

All packages should be named:
  <vendor>\<package_or_component>\<ClassName>

For example:
    pear2\text_diff\Diff
    zend\controller\FrontController
    cake\models\DatabaseModel
  • Namespaces must be lowercase
  • Each package must have a vendor and a top-level namespace at a minimum
  • Each package can have as many sub-namespaces as it wishes
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system
  • Underscores within namespaces have no significant meaning

Class, Interface, and Abstract Names

  • All class names must begin with an uppercase character
  • All class names may contain underscores
  • Any underscores within class names must denote a DIRECTORY_SEPARATOR
  • All interfaces must be suffixed with Interface
  • All abstracts must be suffixed with Abstract
Exception Naming
  • All packages must declare at package level Exception (i.e., pear2\text_diff\Exception)
  • All packages should use SPL Exceptions where applicable
  • Package level Exceptions may be concrete classes, or interfaces
  • All Exceptions thrown within a package should extend or implement the package level Exception
Version: 
1 message about this page
May 28 2009 by Travis Swicegood
Click on http://groups.google.com/group/php-standards/web/php-coding-standard
- or copy & paste it into your browser's address bar if that doesn't
work.
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google