Zend_Application & Boostrap – A hidden secret

3

Posted in Zend Framework | February 26, 2011

From Zend Framework 1.8, the way to use ZF is changed, Zend_Application and Zend_Application_Resource have improved exponentially the way to start up a ZF project.
In this short post I don’t want to show you how to use them, but I want to give you a simple hidden secret.

If you have already used them you know that to launch your ZF application you need to add these lines to your application.ini

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

and create the file boostrapp.php with the following code

<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}

This is the best boostrapp that you can have, without any method. You can obtain this moving all your methods on the resources.
But if I have an empty class why should I create this file?

There is a little tip to remove this file from execution of your scripts, you have to change the previous lines of your application.ini with these

bootstrap.path = APPLICATION_PATH "/../library/Zend/Application/Bootstrap/Bootstrap.php"
bootstrap.class = "Zend_Application_Bootstrap_Bootstrap"