Run PHP files from the command line.
#!/usr/bin/env php
<?php
define('SNIPPETS_START', microtime(true));
if (defined('STDIN'))
{
echo 'PHP version .............: ' . phpversion() . PHP_EOL;
echo 'Script ..................: ' . basename(__FILE__) . PHP_EOL;
echo 'Directory ...............: ' . dirname(__FILE__) . PHP_EOL;
echo 'Start time ..............: ' . SNIPPETS_START . PHP_EOL;
echo 'Shell user ..............: ' . shell_exec('whoami') . PHP_EOL;
}
else
{
echo 'Console mode only!';
exit();
}
require __DIR__ . '/vendor/autoload.php';
// do cool php stuff here ...