svn: /phpdoc/en/trunk/reference/yaf/ yaf-loader.xml

From: Date: Sat, 26 Nov 2011 05:13:58 +0000
Subject: svn: /phpdoc/en/trunk/reference/yaf/ yaf-loader.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9074@lists.php.net to get a copy of this message
laruence Sat, 26 Nov 2011 05:13:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=319899 Log: update docs Changed paths: U phpdoc/en/trunk/reference/yaf/yaf-loader.xml Modified: phpdoc/en/trunk/reference/yaf/yaf-loader.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-loader.xml 2011-11-26 04:41:26 UTC (rev 319898) +++ phpdoc/en/trunk/reference/yaf/yaf-loader.xml 2011-11-26 05:13:58 UTC (rev 319899) @@ -12,8 +12,71 @@ <section xml:id="yaf-loader.intro"> &reftitle.intro; <para> + <classname>Yaf_Loader</classname> introduces a comprehensive autoloading + solution for Yaf. + </para> + <para> + The first time an instance of <classname>Yaf_Application</classname> is retrieved, + <classname>Yaf_Loader</classname> will instance a singleton, and registers itself with + spl_autoload. You retrieve an instance using the <methodname>Yaf_Loader::getInstance</methodname> + </para> + <para> + By default, <classname>Yaf_Loader</classname> assume all Class will store + in the <link linkend="yaf.configuration">global class + directory</link>, which is defined in the php.ini(yaf.library). </para> + + <para> + If you want <classname>Yaf_Loader</classname> search some Class in the + <link linkend="yaf-loader.props.library">local class + directory</link>(which is defined in application.ini, and by default, + it is APPLICATION_PATH . "/libraray"), you should register the class prefix using the + <methodname>Yaf_Loader::registerLocalNameSpace</methodname> + </para> + + <para> + <programlisting role="php"> +<![CDATA[ +// Assuming the following configure in php.ini: +yaf.libraray = "/global_dir" + +//Assuming the following configure in application.ini +application.libraray = APPLICATION_PATH "/library" + +//Assuming the following local name space registerd: +<?php +class Bootstrap extends Yaf_Bootstrap_Abstract{ + public function _initLoader($dispatcher) { + Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar")); + } +?> +]]> + </programlisting> + + then the autoload examples: + <programlisting role="bash"> +<![CDATA[ +class Foo_Bar_Test => + // APPLICATION_PATH/library/Foo/Bar/Test.php + +class GLO_Name => + // /global_dir/Glo/Name.php + +//as of PHP 5.3, you can use namespace +class \Foo\Bar\Dummy => + // APPLICATION_PATH/library/Foo/Bar/Dummy.php + +class \FooBar\Bar\Dummy => + // /global_dir/FooBar/Bar/Dummy.php +]]> + </programlisting> + </para> + + <para> + You may noticed that all the folder is Ucfisted, you can make them all + lowcase by set yaf.lowcase_path = On in php.ini + </para> </section> <!-- }}} --> @@ -71,7 +134,11 @@ <varlistentry xml:id="yaf-loader.props.library"> <term><varname>_library</varname></term> <listitem> - <para></para> + <para> + By default, this value is APPLICATION_PATH . "/library", you can change + this either in the application.ini(application.library) or call to + <methodname>Yaf_Loader::setLibraryPath</methodname> + </para> </listitem> </varlistentry> <varlistentry xml:id="yaf-loader.props.global-library"> @@ -92,6 +159,7 @@ </partintro> + &reference.yaf.entities.yaf-loader;

« previous php.doc.cvs (#9074) next »