Easy command line scripts with Zend Application

David Caunt wrote up a use­ful arti­cle on com­mand line scripting;

As PHP devel­op­ers, it is con­ve­nient to be able to write com­mand line scripts in PHP. In doing so, you will almost cer­tainly want access to Zend Frame­work com­po­nents and their con­fig­u­ra­tions as if you are writ­ing a nor­mal MVC app, but with­out invok­ing the MVC stack and with­out load­ing unnec­es­sary resources. I’ve seen solu­tions where actions are exposed as con­troller actions and called by wget – these are counter-intuitive, inef­fi­cient, and will suf­fer from max exe­cu­tion time­outs and other problems.

Zend_Applicaton to the rescue

Lets start with our website’s public/index.php – the script which sets up and launches an appli­ca­tion. It looks roughly like this:

full arti­cle here; Easy com­mand line scripts with Zend Appli­ca­tion.

Tags: , , , ,

Leave a Comment

*

Get Adobe Flash playerPlugin by wpburn.com wordpress themes