IMPRESS dotted_line CONTACT dotted_line search dotted_line Kontakt dotted_line sitemap dotted_line print
120 PHP-Resource users online

Switch to another languags Deutsch aktuelle Sprache Englisch

PHP Manual

Application Configuration

You should give an array of config or an ini config file(see Yaf_Config_Ini) path to Yaf_Application::__construct().

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 accepcted preferentially.

Example #1 An array of yaf configuration example

= array(
"application" => array(
"directory" => dirname(__FILE__),
"dispatcher" => array(
"catchException" => 0,
"view" => array(
"ext" => "phtml",
$app = new Yaf_Application($config);

Example #2 an ini file of yaf configuration example

[yaf] = APPLICATION_PATH "/appliation"
yaf.dispatcher.catchException = 0

[product : yaf]
; user configuartions list here

Yaf Application Config
Name Default Changelog  
application.ext "php"
application.view.ext "phtml"
application.modules "index"
application.library . "/library" . "/library"
application.library.namespace ""
application.bootstrap . "/Bootstrap" . application.ext
application.baseUri ""
application.dispatcher.throwException 1
application.dispatcher.catchException 0
application.dispatcher.defaultModule "index"
application.dispatcher.defaultController "index"
application.dispatcher.defaultAction "index"

Here's a short explanation of the configuration directives. string

The directory of the application, that is the folder which contains the "controllers", "views", "models", "plugins" folders.


This config entry is the only one which doesn't has a default value, which means you should always define it.

application.ext string

The file ext of the PHP script, used in class autoloading( Yaf_Loader).

application.view.ext string

The file ext of the view template script.

application.modules string

A commaseparated list of the registered modules, used in the route process, especially while there are more than three segments in the PATH_INFO,

Yaf need a way to find out whether the first segment is a module name or not.

application.library string

The local library directory, see Yaf_Loader and yaf.library.


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 string

Introduced in Yaf 2.1.6

application.library.namespace string

A comma separated prefix of local library namespace.

Introduced in Yaf 2.1.6

application.bootstrap string

A absolute path of the Bootstrap class script.

application.baseUri string

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.

In generally, you have no need to set this value.

application.dispatcher.throwException bool

If this is On, Yaf will throw exception while some error occurring. see also Yaf_Dispatcher::throwException().

application.dispatcher.catchException bool

If this is On, Yaf will forward to Error controller, Error Action while there is a uncaught exception. see also Yaf_Dispatcher::catchException().

application.dispatcher.defaultRoute string

The default Route, if it is not specificed, Static route will be used as default route, see: Yaf_Router::addRoute().

application.dispatcher.defaultModule string

The default module name, see also Yaf_Dispatcher::setDefaultModule().

application.dispatcher.defaultController string

The default controller name, see also Yaf_Dispatcher::setDefaultController().

application.dispatcher.defaultAction string

The default action name, see also Yaf_Dispatcher::setDefaultAction().

Comments to the PHP manual
Write new comment


New Tutorial entries

Migration einer PHP 5 App auf PHP 7

Dieses PHP 7 Tutorial zeigt dir, wie du dein PHP5 Script auf PHP7 umstellst.

Berni | Category: PHP
PHP 7 Virtual Machine

Dieser Artikel zielt darauf ab, einen Überblick über die Zend Virtual Machine, wie es in PHP 7 gefunden wird.

Berni | Category: PHP
plotting masters - a professional guide - Teil II

Grafische Interpolation und Bestapproximation von numerischen Wertepaaren: Wir wollen Punkte auf einer Zeichenebene über verschiedene Verfahren miteinander verbinden.

EVAMasters | Category: PHP