Gonzalo Ayuso's Blog: Building a small microframework with PHP (Part 2). Command line interface
In my last post we spoke about building a small microframework with PHP. The main goal of this kind of framework was to be able to map urls to plain PHP classes and become those classes easily testeable with PHPUnit. Now we're going to take a step forward. [...] It's pretty straightforward to create a command line interface (CLI) for our microframework.
He shows how to use the getopt function and the $GLOBALS superglobal to pull in arguments given to the command line script. He hooks this into the framework and makes it possible to define the controller and action to execute (with a few examples to show it in action). You can find this updated code on his github account.