Run Slim 2 from the command line
If you need to run a Slim Framework 2 application from the command line then you need a separate script from your web-facing index.php. Let's call it bin/run.php: bin/run.php: #!/usr/bin/env php <php chdir(dirname(__DIR__)); // set directory to root require 'vendor/autoload.php'; // composer autoload // convert all the command line arguments into a URL $argv = $GLOBALS['argv']; array_shift($GLOBALS['argv']); $pathInfo = '/' . implode('/', $argv); // Create our app instance $app = new Slim\Slim([ 'debug' => false,… continue reading.