How to create a script for the command line in PHP with Zend Framework? -


i need create script run on command line using php , want take advantage of zf , models (classes) have written using it. how do elegantly possible?

you have duplicate code of public/index.php without calling run method of zend_application (which mvc stuff) , load resources need.

#!/usr/bin/php <?php define('application_path', realpath(dirname(__file__) . '/../application'));  set_include_path(realpath(application_path . '/../library'));  require_once 'zend/application.php';  $application = new zend_application(     application_env,     application_path . '/configs/application.ini' ); // load ressources need $application->getbootstrap()->bootstrap(     array(         'db'     ) );  // stuff 

take care of adapt location of cli script.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -