phpAPP: Include file to help with shell PHP scripting, command-line switch input parsing.
Date: 12/02/10
(PHP Development) Keywords: php
I've had to re-write this code so many times I finally put it into it's own .inc(lude) file and posted it up online with a demo php application to show off some of the include's abilities so far even in it's limited state. If people could please check it out and give it a try, I'd like to get some feedback on this project as I'd like to make a very robust include file to help myself and others out with shell scripting in PHP.
Yes, I know shell scripting isn't really done in PHP, but it's a very very powerful language, easily capable of being scripted to become a daemon (bot), or some type of service/server, but the one thing lacking and needed for any command line application is switch input. So here I present phpAPP, the shell scripting helper.
# ./phpapp -test[]=var0 -test[]=var1 -test[0]="var2 var2" -test2=29.95 --var_display=test2 --arr_display=test
OUTPUTS:
Display test2: 29.95
Display test: Array
(
[0] => var2 var2
[1] => var1
)
This is just an example of some of the basic stuff you can accomplish with this.
http://www.cynagen.com/home.php?page=phpapp -- Latest version will always be available here. Again, please comment.
Source: http://php-dev.livejournal.com/84422.html