• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Command/H03-May-2022-811349

Descriptor/H03-May-2022-1,107619

Event/H03-May-2022-21785

Formatter/H03-May-2022-739309

Helper/H03-May-2022-1,882935

Input/H03-May-2022-1,862800

Output/H03-May-2022-681243

Resources/bin/H03-May-2022-

Tester/H03-May-2022-262114

Tests/H03-May-2022-6,3674,697

Application.phpH A D27-Apr-201434.8 KiB1,105598

CHANGELOG.mdH A D27-Apr-20141.6 KiB4637

ConsoleEvents.phpH A D27-Apr-20141.5 KiB568

LICENSEH A D27-Apr-20141 KiB2016

README.mdH A D27-Apr-20141.9 KiB6444

Shell.phpH A D27-Apr-20146.2 KiB229138

autoloader.phpH A D27-Apr-2014337 1613

composer.jsonH A D27-Apr-2014869 3837

phpunit.xml.distH A D27-Apr-2014873 3128

README.md

1Console Component
2=================
3
4Console eases the creation of beautiful and testable command line interfaces.
5
6The Application object manages the CLI application:
7
8    use Symfony\Component\Console\Application;
9
10    $console = new Application();
11    $console->run();
12
13The ``run()`` method parses the arguments and options passed on the command
14line and executes the right command.
15
16Registering a new command can easily be done via the ``register()`` method,
17which returns a ``Command`` instance:
18
19    use Symfony\Component\Console\Input\InputInterface;
20    use Symfony\Component\Console\Input\InputArgument;
21    use Symfony\Component\Console\Input\InputOption;
22    use Symfony\Component\Console\Output\OutputInterface;
23
24    $console
25        ->register('ls')
26        ->setDefinition(array(
27            new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'),
28        ))
29        ->setDescription('Displays the files in the given directory')
30        ->setCode(function (InputInterface $input, OutputInterface $output) {
31            $dir = $input->getArgument('dir');
32
33            $output->writeln(sprintf('Dir listing for <info>%s</info>', $dir));
34        })
35    ;
36
37You can also register new commands via classes.
38
39The component provides a lot of features like output coloring, input and
40output abstractions (so that you can easily unit-test your commands),
41validation, automatic help messages, ...
42
43Tests
44-----
45
46You can run the unit tests with the following command:
47
48    $ cd path/to/Symfony/Component/Console/
49    $ composer.phar install
50    $ phpunit
51
52Third Party
53-----------
54
55`Resources/bin/hiddeninput.exe` is a third party binary provided within this
56component. Find sources and license at https://github.com/Seldaek/hidden-input.
57
58Resources
59---------
60
61[The Console Component](http://symfony.com/doc/current/components/console.html)
62
63[How to create a Console Command](http://symfony.com/doc/current/cookbook/console/console_command.html)
64