I am developing a PHP CLI tool, which I want to bootstrap with CodeIgniter to be able to use some of it’s libraries, like database and accessing configuration.
So basically I want to have a CLI script, that would allow me to load up the CodeIgniter environment and then do $CI->db->stuff().
I know that I could create a controller for this but I am looking for a way to make it CodeIgniter-installation-independent, so that I could simply $ cd into a dir, load it’s CI environment and perform magic via command line. Another reason why I don’t want to use a controller is that I don’t want it to be accessible to public via address bar.
So, any ideas?
Command line capabilities are baked into the latest version now. Enjoy:
http://codeigniter.com/user_guide/general/cli.html