简体   繁体   中英

Is it possible to use Zend modular structure without including “application.php” (which loads too many excess resourses)?

I'm looking for solution how to get rid of including "application.php" and at the same time i want to have possibility to use modular structure in Zend Framework. APPLICATION loads too many unnecessary and excess things (if Zend Framework is being used not by 100%). Working with high-loaded project i found that it's good to disable Zend Autoloader and include own-made file "ZendLight_small.php" (where i put all all missing classes/functions which are being required by Zend Framework) for increasing quantity of possible successful calls. (with Zend Autoloader - 40 calls per second (by JMeter), with ZendLight_small.php - 60 cps.)

...
I also wanna get rid of next thing (i dont need bootstrap structure also):

$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();

...
So, is it somehow possible? I just don't need to use so much Zend functions, but total sum of included files (with Zend Application) is a mess. Thanks beforehand.

I have been using Zend components for close to 6 months now, but have never used Zend_Application.

I guess the main reason is I mostly develop console scripts, and use the components as helpers. Zend_ classes are part of the applications, not the application. I start with a minimal bootstrap file that defines the script constants. Then I initialize Zend_Autoload and from then on have access to whatever I feel like in Zend. Last initialisation step but not least, I have a settings file that is just a plain array returned and loaded in Zend_Config.

These 3-4 lines of very lightweight code have made my life so much better, you would not believe. I mostly rely on Zend_logger, Zend_DB and its friends Zend_Table, Zend_TableRowset etc .. and Zend_Mail. Loaded only if needed.

Although I only use a very small subset of the framework, it has greatly cut down my developpment time and most important: the result is way easier to maintain.

You can use the "old" (pre-1.8) bootstrap method. No need for Zend_Application. We use that with ZF 1.11 with no problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM