Prefix all classes with PEAR_
Purpose of this proposal
The class names of all packages should be prefixed with PEAR_.
What happened because of unprefixed PEAR classes
PHP 5.1.0 introduced a native Date class which broke
applications using PEAR as many of them require PEAR::Date.
Including Date.php resulted in a fatal error as two classes
of the same name may not be defined. PHP 5.1.1 was released
a few days later disabling the native date class .
The SPL class FileObject was formerly known as File
but renamed in favor of the PEAR class File .
Advantages of prefixing
Prefixing makes PEAR less intrusive as widely used class names
like DB, File or Image are now available to the core
developers and end user and not reserved for PEAR.
Alternative prefixes arised during discussion
- is not an existing class like PEAR_
- uses the first character of PEAR, but also of PHP
- is short
- is not the PEAR class name in a case sensitive way
- clearly states the origin of the package
In general, prefixing classes means that they extend the prefixed
class. With the current lack of namespace support in PHP which is
currently not yet planned for PHP6 this is the only
possible solution to prevent further incidents like these
Changing the class name is considered a BC break. Packages must
be updated if a BC break is allowed according to the version
naming guidelines .