Skip to content
Advertisement

Bootstrap PHP file before `php -a`

Is there a way to run a bootstrap code at every start of PHP interactive shell? Something like this:

JavaScript

Advertisement

Answer

You can use the auto_append_file directive for your cli configuration.

Example mine:

JavaScript

boot.php file:

JavaScript

php -a test:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement