Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/contao-community-alliance/console

Console application for Contao Open Source CMS
https://github.com/contao-community-alliance/console

Last synced: about 1 month ago
JSON representation

Console application for Contao Open Source CMS

Awesome Lists containing this project

README

        

Console Integration
===================

Register you console command classes in `$GLOBALS['CONSOLE_CMD']` within your `config.php`.

**config.php**
```php
setName('demo:greet')
->setDescription('Greet someone')
->addArgument(
'name',
InputArgument::OPTIONAL,
'Who do you want to greet?'
)
->addOption(
'yell',
null,
InputOption::VALUE_NONE,
'If set, the task will yell in uppercase letters'
)
;
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
if ($name) {
$text = 'Hello '.$name;
} else {
$text = 'Hello';
}

if ($input->getOption('yell')) {
$text = strtoupper($text);
}

$output->writeln($text);
}
}
```

If you need a more complex setup routine, use the `initializeConsole` hook.

**config.php**
```php
add(new GreetCommand());
}
}
```

For details see http://symfony.com/doc/2.3/components/console/introduction.html