Yaf_Application::__construct
(Yaf >=1.0.0)
Yaf_Application::__construct — Yaf_Application constructor
Parameters
config
-
An INI configuration file path, or a configuration array.
If it is an INI configuration file, there should be a section named
as the one defined by
yaf.environ, which is
"product" by default.
The application configuration entries (and their default values) are
documented in
Application Configuration:
Example #1 An ini config file example
[product]
;this one should always be defined, and has no default value
application.directory=APPLICATION_PATH
;following configs have default values, you may not need to define them
application.library = APPLICATION_PATH . "/library"
application.dispatcher.throwException=1
application.dispatcher.catchException=1
application.baseUri=""
;the php script ext name
application.ext=php
;the view template ext name
application.view.ext=phtml
application.dispatcher.defaultModule=Index
application.dispatcher.defaultController=Index
application.dispatcher.defaultAction=index
;defined modules
application.modules=Index
environ
-
Which section will be loaded as the final configuration. If it is
not given, the value of the
yaf.environ directive is
used.
Examples
Example #2 Yaf_Application::__construct() example
<?php
defined('APPLICATION_PATH') // APPLICATION_PATH will be used in the ini config file
|| define('APPLICATION_PATH', __DIR__);
$application = new Yaf_Application(APPLICATION_PATH.'/conf/application.ini');
$application->bootstrap()->run();
?>
Example #3 Yaf_Application::__construct() example
<?php
$config = array(
"application" => array(
"directory" => realpath(dirname(__FILE__)) . "/application",
),
);
/** Yaf_Application */
$application = new Yaf_Application($config);
$application->bootstrap()->run();
?>