2017 © Pedro Peláez
 

contao-module console

CLI console application for Contao Open Source CMS

image

contao-community-alliance/console

CLI console application for Contao Open Source CMS

  • Friday, June 6, 2014
  • by xtra
  • Repository
  • 3 Watchers
  • 0 Stars
  • 3,132 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

Console Integration

Register you console command classes in $GLOBALS['CONSOLE_CMD'] within your config.php., (*1)

config.php, (*2)

<?php

$GLOBALS['CONSOLE_CMD'][] = 'Acme\Command\GreetCommand';

GreetCommand.php, (*3)

<?php

namespace = Acme\Command;

class GreetCommand extends \Symfony\Component\Console\Command\Command
{
    protected function configure()
    {
        $this
            ->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., (*4)

config.php, (*5)

<?php

$GLOBALS['TL_HOOKS']['initializeConsole'][] = array('Acme\Console', 'myInitializeConsole');

Console.php, (*6)

<?php

namespace Acme;

use Symfony\Component\Console\Application;
use Acme\Command\GreetCommand;

class Console
{
    public function myInitializeConsole(Application $application)
    {
        $application->add(new GreetCommand());
    }
}

For details see http://symfony.com/doc/2.3/components/console/introduction.html, (*7)

The Versions

06/06 2014

dev-develop

dev-develop

CLI console application for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

console cli contao

06/06 2014

dev-master

9999999-dev

CLI console application for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

console cli contao

06/06 2014

1.0.1

1.0.1.0

CLI console application for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

console cli contao

05/06 2014

1.0

1.0.0.0

CLI console application for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

console cli contao