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
Post a Comment