php-doc-en/reference/yaf/appconfig.xml
Xinchen Hui f7975b51dd more infos about yaf loader
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@329592 c90b9560-bf6c-de11-be94-00142212c4b1
2013-02-28 05:53:22 +00:00

400 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="yaf.appconfig" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title xmlns="http://docbook.org/ns/docbook">Application Configuration</title>
<para>
You should give an array of config or an ini config file(see
<classname>Yaf_Config_Ini</classname>) path to
<methodname>Yaf_Application::__construct</methodname>.
</para>
<para>
Yaf configurations could be merged with user configurations. The difference
is, Yaf configurations are prefixed with "yaf." or "application.", if there
are both "yaf." and "application.", "application." will be used.
<example>
<title>An array of yaf configuration example</title>
<programlisting role="php">
<![CDATA[
<?php
$configs = array(
"application" => array(
"directory" => dirname(__FILE__),
"dispatcher" => array(
"catchException" => 0,
),
"view" => array(
"ext" => "phtml",
),
),
);
$app = new Yaf_Application($config);
?>
]]>
</programlisting>
</example>
<example>
<title>an ini file of yaf configuration example</title>
<programlisting role="ini">
<![CDATA[
[yaf]
yaf.directory = APPLICATION_PATH "/appliation"
yaf.dispatcher.catchException = 0
[product : yaf]
; user configuration list here
]]>
</programlisting>
</example>
</para>
<para>
<table>
<title>Yaf Application Config</title>
<tgroup cols="3">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Default;</entry>
<entry>&Changelog;</entry>
</row>
</thead>
<tbody>
<row>
<entry>application.directory</entry>
<entry></entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.ext</entry>
<entry>"php"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.view.ext</entry>
<entry>"phtml"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.modules</entry>
<entry>"index"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.library</entry>
<entry>application.directory . "/library"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.library.directory</entry>
<entry>application.directory . "/library"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.library.namespace</entry>
<entry>""</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.bootstrap</entry>
<entry>application.directory . "/Bootstrap" . application.ext</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.baseUri</entry>
<entry>""</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.defaultRoute</entry>
<entry></entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.throwException</entry>
<entry>1</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.catchException</entry>
<entry>0</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.defaultModule</entry>
<entry>"index"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.defaultController</entry>
<entry>"index"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.dispatcher.defaultAction</entry>
<entry>"index"</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>application.system</entry>
<entry></entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
&ini.descriptions.title;
<para>
<variablelist>
<varlistentry xml:id="configuration.yaf.directory">
<term>
<parameter>application.directory</parameter>
<type>string</type>
</term>
<listitem>
<para>
The directory of the application, that is the folder which contains the
"controllers", "views", "models", "plugins" folders.
</para>
<para>
<note>
<para>
This config entry is the only one which doesn't has a default value, which means you should
always define it.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.ext">
<term>
<parameter>application.ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
The file ext of the PHP script, used in class autoloading(
<classname>Yaf_Loader</classname>).
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.view.ext">
<term>
<parameter>application.view.ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
The file ext of the view template script.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.modules">
<term>
<parameter>application.modules</parameter>
<type>string</type>
</term>
<listitem>
<para>
A comma-separated list of the registered modules, used in the route
process, especially while there are more than three segments in the PATH_INFO,
</para>
<para>
Yaf need a way to find out whether the first segment is a module name or not.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.library">
<term>
<parameter>application.library</parameter>
<type>string</type>
</term>
<listitem>
<para>
The local library directory, see <classname>Yaf_Loader</classname> and
<link linkend="ini.yaf.library">yaf.library</link>.
</para>
<note>
<para>
As of Yaf 2.1.6, this config entry can also be a array, when it is
array, then the library path will try to use the value of <link
linkend="configuration.yaf.library.directory">application.library.directory</link>
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.library.directory">
<term>
<parameter>application.library.directory</parameter>
<type>string</type>
</term>
<listitem>
<para>
Alias of <link
linkend="configuration.yaf.library">application.library</link>. Introduced
in Yaf 2.1.6
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.library.namespace">
<term>
<parameter>application.library.namespace</parameter>
<type>string</type>
</term>
<listitem>
<para>
A comma-separated prefix of local library namespace.
</para>
<para>
Introduced in Yaf 2.1.6
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.bootstrap">
<term>
<parameter>application.bootstrap</parameter>
<type>string</type>
</term>
<listitem>
<para>
A absolute path of the Bootstrap class script.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.baseuri">
<term>
<parameter>application.baseUri</parameter>
<type>string</type>
</term>
<listitem>
<para>
Used to remove a fixed prefix of request uri in route process.
Take a example, comes a request with request uri
"/prefix/controller/action". if you set application.baseUri to
"/prefix", then only "/controller/action" will take as the PATH_INFO in
route process.
</para>
<para>
In generally, you have no need to set this value.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.throwexception">
<term>
<parameter>application.dispatcher.throwException</parameter>
<type>bool</type>
</term>
<listitem>
<para>
If this is On, Yaf will throw exception while some error occurring. see
also <methodname>Yaf_Dispatcher::throwException</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.catchexception">
<term>
<parameter>application.dispatcher.catchException</parameter>
<type>bool</type>
</term>
<listitem>
<para>
If this is On, Yaf will forward to Error controller, Error Action while
there is a uncaught exception. see also
<methodname>Yaf_Dispatcher::catchException</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.defaulRoute">
<term>
<parameter>application.dispatcher.defaultRoute</parameter>
<type>string</type>
</term>
<listitem>
<para>
The default Route, if it is not specificed, Static route will be used
as default route, see:
<methodname>Yaf_Router::addRoute</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.defaultmodule">
<term>
<parameter>application.dispatcher.defaultModule</parameter>
<type>string</type>
</term>
<listitem>
<para>
The default module name, see also
<methodname>Yaf_Dispatcher::setDefaultModule</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.defaultcontroller">
<term>
<parameter>application.dispatcher.defaultController</parameter>
<type>string</type>
</term>
<listitem>
<para>
The default controller name, see also
<methodname>Yaf_Dispatcher::setDefaultController</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.dispatcher.defaultaction">
<term>
<parameter>application.dispatcher.defaultAction</parameter>
<type>string</type>
</term>
<listitem>
<para>
The default action name, see also
<methodname>Yaf_Dispatcher::setDefaultAction</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="configuration.yaf.system">
<term>
<parameter>application.system</parameter>
<type>string</type>
</term>
<listitem>
<para>
Set yaf runtime configure in application.ini, like:
<link linkend="ini.yaf.lowcase-path">application.system.lowcase_path</link>
<note>
<para>
only those PHP_INI_ALL configures can be set in this way
</para>
</note>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->