2017 © Pedro Peláez
 

library console

image

asgard/console

  • Friday, May 13, 2016
  • by leyou
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Console

The Asgard Console package is an simple extension to the Symfony Console component., (*1)

, (*2)

Installation

If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries., (*3)

composer require asgard/console 0.*

, (*4)

Usage

MyCommand class, (*5)

class MyCommand extends Asgard\Console\Command {
    protected $name = 'mycommand';
    protected $description = 'This is my command';

    protected function getOptions() {
        return [
            ['verbose', null, InputOption::VALUE_NONE, 'Verbose output.', null]
        ];
    }

    protected function getArguments() {
        return [
            ['argument', InputArgument::REQUIRED, 'An argument.'],
        ];
    }
}

Console script:, (*6)

$command = new MyCommand; #extends Asgard\Console\Command
containerlication = new MyApplication('MyApp', 5.6, new \Asgard\Container\Container); #extends Asgard\Console\Application
#application constructor parameters are optional
containerlication->add($command);

Command:, (*7)

php console mycommand theargument --verbose

, (*8)

Command methods

Get the services container, (*9)

$this->getContainer();

Call another command, (*10)

$this->call('another-command', $arguments=[]);

Call another command silently (no output), (*11)

$this->callSilent('another-command', $arguments=[]);

Ask for confirmation, (*12)

$this->confirm('Are you sure?');

Display an information, (*13)

$this->info('A message');

Display an error, (*14)

$this->error('A message');

Display a comment, (*15)

$this->comment('A message');

Display a question, (*16)

$this->question('A message');

, (*17)

Application methods

$container = $this->getContainer();

Contributing

Please submit all issues and pull requests to the asgardphp/asgard repository., (*18)

License

The Asgard framework is open-sourced software licensed under the MIT license, (*19)

The Versions

13/05 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

13/05 2016

v0.3.1

0.3.1.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

12/05 2016

v0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

13/06 2015

v0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud

09/09 2014

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

by Michel Hognerud