JavaScript Editor Javascript validator     Web page editor 


PEAR_Validate::_validPackageName()  -- Override this method to handle validation of normal package names


require_once '/Validate.php';

bool PEAR_Validate::_validPackageName (string $name)


This protected method can be used to change the normal package validation scheme. By default, all packages must begin with a letter and contain only letters, numbers and underscores. Using this method, it is possible to change this entirely to enforce another scheme.

For instance, enforcing java-style com.blah.package package names can be done simply by this code:

require_once 'PEAR/Validate.php';
class MyChannel_Validate extends PEAR_Validate
    function _validPackageName($name)
        return preg_match('/[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)*/', $name);

Then, by using a customized channel validation package, the installer will enforce java-style package names for your channel.


string $name

package name string to test for validity.


throws no exceptions thrown


This function can not be called statically.

JavaScript Editor Javascript validator     Web page editor