Skip to content

Instantly share code, notes, and snippets.

@bronek89
Forked from dhrrgn/console
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save bronek89/374e2773bc0eb1d0abc6 to your computer and use it in GitHub Desktop.

Select an option

Save bronek89/374e2773bc0eb1d0abc6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
require 'vendor/autoload.php';
$app = new Application;
// Add global Options to the Application
$app->getDefinition()->addOptions([
new InputOption('--env', '-e', InputOption::VALUE_OPTIONAL, 'The environment to operate in.', 'DEV'),
]);
// You could add global arguments as well
$app->getDefinition()->addArguments([
// Arguments Here
]);
// Add the commands.
$app->add(new SomeCommand);
// Run it.
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment