examples/console/hello_world/bin/console
#!/usr/bin/env php
<?php
// Autoload packages
require_once __DIR__ . '/../../../../vendor/autoload.php';
// Alias symfony console application
use Symfony\Component\Console\Application as ConsoleApplication;
use Symfony\Component\ClassLoader\Psr4ClassLoader;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputOption;
use Boot\Boot;
// Get environment
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), Boot::PRODUCTION);
// Register autoloader (in your own product use the autoloader that ships with composer, this is just for demo purposes)
$loader = new Psr4ClassLoader();
$loader->addPrefix('HelloWorld\\', __DIR__ . '/../src/HelloWorld');
$loader->register();
// Build application
$rootDir = realpath(__DIR__ . '/..');
$app = (new \Boot\Console\ConsoleBuilder($rootDir))
->appName('SimpleConsoleApplication')
->appVersion('1.0.0')
->optimize('tmp/cache')
->environment($env)
->configDir('resources/config')
->parameter('project_dir', $rootDir)
->build()
;
// Run the application
$app->run();