Browse files

fixed README for Console

  • Loading branch information...
1 parent 4f88235 commit 7f8ebd51d9d04378385ccd4d14f9d7e58f0c96d8 @lsmith77 lsmith77 committed Nov 3, 2011
Showing with 44 additions and 44 deletions.
  1. +44 −44
@@ -1,44 +1,44 @@
-What is Symfony2?
-Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and
-flexibility in mind. It allows developers to build better and easy to maintain
-websites with PHP.
-Symfony can be used to develop all kind of websites, from your personal blog
-to high traffic ones like Dailymotion or Yahoo! Answers.
-Symfony2 is only supported on PHP 5.3.2 and up.
-The best way to install Symfony2 is to download the Symfony Standard Edition
-available at [][1].
-The "[Quick Tour][2]" tutorial gives you a first feeling of the framework. If,
-like us, you think that Symfony2 can help speed up your development and take
-the quality of your work to the next level, read the official
-[Symfony2 documentation][3].
-Symfony2 is an open source, community-driven project. If you'd like to contribute,
-please read the [Contributing Code][4] part of the documentation. If you're submitting
-a pull request, please follow the guidelines in the [Submitting a Patch][5] section.
+Console Component
+Even if we are talking about a web framework, having some tools to manage
+your project from the command line is nice. In Symfony2, we use the console
+to generate CRUDs, update the database schema, etc. It's not required, but
+it is really convenient and it can boost your productivity a lot.
+This example shows how to create a command line tool very easily:
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+$console = new Application();
+ ->register('ls')
+ ->setDefinition(array(
+ new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'),
+ ))
+ ->setDescription('Displays the files in the given directory')
+ ->setCode(function (InputInterface $input, OutputInterface $output) {
+ $dir = $input->getArgument('dir');
+ $output->writeln(sprintf('Dir listing for <info>%s</info>', $dir));
+ })
+With only 10 lines of code or so, you have access to a lot of features like output
+coloring, input and output abstractions (so that you can easily unit-test your
+commands), validation, automatic help messages, and a lot more. It's really powerful.
+Unit tests:

0 comments on commit 7f8ebd5

Please sign in to comment.