Yaf_Application::getAppDirectory

(Yaf >=2.1.4)

Yaf_Application::getAppDirectoryGet the application directory

Description

public function Yaf_Application::getAppDirectory(): ?string

Get the application directory, under which Yaf looks for controllers, views and modules. It is set by the application.directory configuration entry, or by Yaf_Application::setAppDirectory().

Parameters

This function has no parameters.

Return Values

The absolute path of the application directory, or null if the application is not properly initialized.

Examples

Example #1 Yaf_Application::getAppDirectory() example

<?php
/* conf/application.ini:
   application.directory = APPLICATION_PATH "/application"
*/
$app = new Yaf_Application(
    new Yaf_Config_Ini(APPLICATION_PATH . "/conf/application.ini", "product")
);

var_dump($app->getAppDirectory());
var_dump(Yaf_Application::app()->getAppDirectory());
?>

The above example will output something similar to:

string(31) "/var/www/html/myapp/application"
string(31) "/var/www/html/myapp/application"

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.