cvs: peardoc /en/pyrus plugins.xml /en/pyrus/plugins command.xml

From: Date: Tue, 30 Jun 2009 05:38:17 +0000
Subject: cvs: peardoc /en/pyrus plugins.xml /en/pyrus/plugins command.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11711@lists.php.net to get a copy of this message
cellog Tue Jun 30 05:38:17 2009 UTC Modified files: /peardoc/en/pyrus plugins.xml /peardoc/en/pyrus/plugins command.xml Log: slight re-organization: make docs on loading plugins generic http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/plugins.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/pyrus/plugins.xml diff -u peardoc/en/pyrus/plugins.xml:1.3 peardoc/en/pyrus/plugins.xml:1.4 --- peardoc/en/pyrus/plugins.xml:1.3 Sun Jun 28 14:47:15 2009 +++ peardoc/en/pyrus/plugins.xml Tue Jun 30 05:38:17 2009 @@ -55,6 +55,51 @@ </programlisting> </para> + <section xml:id="pyrus.plugins.autoload"> + <title>Telling Pyrus how to load your plugin: &lt;class&gt; and &lt;autoloadpath&gt;</title> + <para> + Pyrus relies upon PHP5's autoloading capabilities to automatically load a plugin + class. All plugins should include the <literal>&lt;autoloadpath&gt;</literal> + element to specify + a path relative to the <link linkend="pyrus.configuration.system.phpdir">php_dir</link> + location for the plugin registry. For plugin classes that conform to PEAR2 + standards, the autoloadpath should be an empty string: + </para> + <programlisting role="xml"> + <![CDATA[ +<autoloadpath></autoloadpath> + ]]> + </programlisting> + <para> + The pyrus autoloader will automatically replace <literal>_</literal> and + the namespace separator <literal>\</literal> with <constant>DIRECTORY_SEPARATOR</constant> + and append <literal>.php</literal> to determine the class name to load. To + instruct Pyrus to prepend a particular relative path, put this path in the + <literal>&lt;autoloadpath&gt;</literal> element. As an example, the following + XML will prompt Pyrus to load the file + <literal>/home/user/.pear/MyPackage/customcommands/Command/Line/Obj.php</literal> + if the user's <link linkend="pyrus.configuration.user.pluginsdir">plugins_dir</link> + is <literal>/home/user/.pear</literal>: + </para> + <programlisting role="xml"> + <![CDATA[ +<autoloadpath>MyPackage/customcommands</autoloadpath> +<class>Command_Line\Obj</class> + ]]> + </programlisting> + <para> + The <literal>&lt;class&gt;</literal> element is used by Pyrus to determine + which object to instantiate. If <literal>&lt;class&gt;</literal> is: + </para> + <programlisting role="xml"> + <![CDATA[ +<class>FooBar_Willy\Dilly</class> + ]]> + </programlisting> + <para> + Pyrus will instantiate an object of class <literal>FooBar_Willy\Dilly</literal>. + </para> + </section> &pyrus.plugins.command; &pyrus.plugins.role; &pyrus.plugins.task; http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/plugins/command.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/pyrus/plugins/command.xml diff -u peardoc/en/pyrus/plugins/command.xml:1.3 peardoc/en/pyrus/plugins/command.xml:1.4 --- peardoc/en/pyrus/plugins/command.xml:1.3 Tue Jun 30 05:20:49 2009 +++ peardoc/en/pyrus/plugins/command.xml Tue Jun 30 05:38:17 2009 @@ -153,46 +153,8 @@ <section xml:id="pyrus.plugins.command.autoload"> <title>Telling Pyrus how to load your command: &lt;class&gt; and &lt;autoloadpath&gt;</title> <para> - Pyrus relies upon PHP5's autoloading capabilities to automatically load a plugin - class. All custom commands should include the <literal>&lt;autoloadpath&gt;</literal> - element to specify - a path relative to the <link linkend="pyrus.configuration.system.phpdir">php_dir</link> - location for the plugin registry. For custom commands that conform to PEAR2 - standards, the autoloadpath should be an empty string: - </para> - <programlisting role="xml"> - <![CDATA[ -<autoloadpath></autoloadpath> - ]]> - </programlisting> - <para> - The pyrus autoloader will automatically replace <literal>_</literal> and - the namespace separator <literal>\</literal> with <constant>DIRECTORY_SEPARATOR</constant> - and append <literal>.php</literal> to determine the class name to load. To - instruct Pyrus to prepend a particular relative path, put this path in the - <literal>&lt;autoloadpath&gt;</literal> element. As an example, the following - XML will prompt Pyrus to load the file - <literal>/home/user/.pear/MyPackage/customcommands/Command/Line/Obj.php</literal> - if the user's <link linkend="pyrus.configuration.user.pluginsdir">plugins_dir</link> - is <literal>/home/user/.pear</literal>: - </para> - <programlisting role="xml"> - <![CDATA[ -<autoloadpath>MyPackage/customcommands</autoloadpath> -<class>Command_Line\Obj</class> - ]]> - </programlisting> - <para> - The <literal>&lt;class&gt;</literal> element is used by Pyrus to determine - which object to instantiate. If <literal>&lt;class&gt;</literal> is: - </para> - <programlisting role="xml"> - <![CDATA[ -<class>FooBar_Willy\Dilly</class> - ]]> - </programlisting> - <para> - Pyrus will instantiate an object of class <literal>FooBar_Willy\Dilly</literal>. + This is the same method used for all plugins, and is documented + <link linkend="pyrus.plugins.autoload">here</link>. </para> <para> The three frontend command handlers are discussed in the

« previous php.pear.doc (#11711) next »