Bootstrapping


Description


If you need to define some global convenience functions, constants or set up autoloading of third party libraries then app/bootstrap.php is the place to do so. The file gets included during the framework initialization.


Examples


The following example shows you how to set up autoloading of Doctrine and Zend. Just download Doctrine and Zend, drop the Doctrine and Zend directories in the libraries directory and finally add this to the bootstrap file. You should now be able to use Doctrine and Zend in your application.


require MAKO_LIBRARIES_PATH . '/doctrine/Doctrine.php';

spl_autoload_register(array('Doctrine', 'autoload'));

set_include_path(get_include_path() . PATH_SEPARATOR . MAKO_LIBRARIES_PATH);

require MAKO_LIBRARIES_PATH . '/Zend/Loader/Autoloader.php';

Zend_Loader_Autoloader::getInstance();

The Mako autoloader is PSR-0 compatible so if the library you're going to include follows the same naming convention then you can just drop it into the libraries directory and start using it without doing anything else.