PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Telling Pyrus how to load your plugin: <class> and <autoloadpath>

Pyrus relies upon PHP5's autoloading capabilities to automatically load a plugin class. All plugins should include the <autoloadpath> element to specify a path relative to the php_dir location for the plugin registry. For plugin classes that conform to PEAR2 standards, the autoloadpath should be an empty string:

<autoloadpath></autoloadpath>

The pyrus autoloader will automatically replace _ and the namespace separator \ with DIRECTORY_SEPARATOR and append .php to determine the class name to load. To instruct Pyrus to prepend a particular relative path, put this path in the <autoloadpath> element. As an example, the following XML will prompt Pyrus to load the file /home/user/.pear/MyPackage/customcommands/Command/Line/Obj.php if the user's plugins_dir is /home/user/.pear:

<autoloadpath>MyPackage/customcommands</autoloadpath>
<class>Command_Line\Obj</class>

The <class> element is used by Pyrus to determine which object to instantiate. If <class> is:

<class>FooBar_Willy\Dilly</class>

Pyrus will instantiate an object of class FooBar_Willy\Dilly.

PEAR Manual