JavaScript Editor Javascript validator     Web page editor 

Chapter 4. PEAR2 Coding Standards

Table of Contents
Coding Standards to be used in PEAR2 (version 1)

Note: This document cannot be considered complete (e.g.: the future of namespaces is uncertain).


PEAR 1.x is very successful at managing the universe of PEAR-installable code. The new Pyrus installer is designed to expand that universe to include code that can also be easily embedded in non-PEAR applications and that runs identically when simply unzipped and when installed. The PEAR2 repository must adhere to different coding conventions than the PEAR repository to make this possible. This document itemizes all the changes to existing rules and coding standards found here. Any conflict between these standards and the existing standards resolves in favor of the new standards. These standards do not affect the coding standards for PEAR packages hosted at, only PEAR2 packages hosted at

require_once introduces a rigidity to package structure that limits the possible uses of a PEAR package. Some of the problems:

Some of the benefits of require_once:

The removal of require_once necessitates another method for loading internal dependencies, both files within a package and external files. This proposal introduces 2 possible methods for doing this:

In all cases, the onus of loading needed files is shifted to the end user. However, for beginning users, the only required step is to load PEAR2/Autoload.php, which will be always bundled with new packages, but only extracted if used as unzip-and-go (pyrus would simply install the dependency on PEAR2, which would contain the needed base files PEAR2_Exception and PEAR2_Autoload).
  require '/full/path/to/PEAR2/Autoload.php';
  // now you can start using all PEAR2 packages
PEAR2/Autoload.php automatically sets up include_path if it does not contain the correct value, and also automatically declares an autoloader either using __autoload() or spl_autoload_register(), preserving existing autoloaders set up by the user.

Bitcoin Dice - Crypto Casino

JavaScript Editor Javascript validator     Web page editor