Yaf_Application::bootstrap

(Yaf >=1.0.0)

Yaf_Application::bootstrapCall bootstrap

Description

publicYaf_Application::bootstrap(Yaf_Bootstrap_Abstract$bootstrap = ?): void

Run a Bootstrap, all the methods defined in the Bootstrap and named with prefix "_init" will be called according to their declaration order, if the parameter bootstrap is not supplied, Yaf will look for a Bootstrap under application.directory.

Parameters

bootstrap

A Yaf_Bootstrap_Abstract instance

Return Values

Yaf_Application instance

Examples

Example #1 A Bootstrap()example

<?php

class Bootstrap extends Yaf_Bootstrap_Abstract {
function
_initConfig(Yaf_Dispatcher $dispatcher) {
echo
"1st called\n";
}

function
_initPlugin($dispatcher) {
echo
"2nd called\n";
}
}
?>

Example #2 Yaf_Application::bootstrap()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();
?>

The above example will output something similar to:

1st called 2nd called
To Top