previousCreating plugins for Pyrus (Previous) (Next) Pyrus plugins: custom commandsnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Dutch | French | German | Hungarian | Polish | Russian | Spanish | Turkish

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.

previousCreating plugins for Pyrus (Previous) (Next) Pyrus plugins: custom commandsnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.