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
.