I would like to script some initial input that I find myself repeatedly inputting when using the PHP CLI. Is this possible? I'm on a linux machine, so some form of Bash + PHP would work for me if this isn't natively supported by PHP on its own.
E.g.
php -a
php > include "MyClassWithReallyVerboseName.php";
php > $o = new MyClassWithReallyVerboseName("The parameters are also pretty verbose");
I would like to be able to script these first two lines of PHP, so that when I execute the interactive command line the class file has already been included and the $o object will already be initialized.
Edit: My initial search did not yield any useful results, but after I posted the question I found this useful thread in the "Related" column of my post: initialising PHP interactive
The solution appears to be to include a define flag when launching interactive mode, including the special INI parameter auto_prepend_file.
php -d auto_prepend_file="/path/to/init/file" -a