Improved command line support

Uses PHP_SAPI to decide CLI block should run
Output JSON that can be parsed by NODE.js in CLI
Merge pull request #13 from chernjie/master

Improved support for CLI development work