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

https://github.com/exu/symfony2-console-standalone

Using Symfony 2 Console component standalone
https://github.com/exu/symfony2-console-standalone

Last synced: 10 months ago
JSON representation

Using Symfony 2 Console component standalone

Awesome Lists containing this project

README

          

** Using Symfony2 Console as standalone component.

#+ATTR_HTML: title="Google.com"
[[http://wysocki.in/assets/img/sf2-console-component.png]]

All files are located on My GitHub project: [[https://github.com/exu/symfony2-console-standalone][Symfony2 Console as standalone component]]

To use symfony console you should create =[[https://github.com/exu/symfony2-console-standalone/blob/master/composer.json][composer.json]]= file and add =symfony/console= component
You should replace "=dev-master=" to current stable version (I'm trying whats new in development branch).

I'm using composer autoloader, so in this example all classes will be loaded from =src= directory,
you can change it to other dir (in =composer.json=)

Next run =$ composer update= to install dependencies in your new project.

Next thing to do is Your new shiny command loader.
Put it in =bin/console= file - or whatever you want - but if you change
directory position remember that you should adjust your paths [[https://github.com/exu/symfony2-console-standalone/blob/master/bin/console][details in console file]]

Finally create your new command [[https://github.com/exu/symfony2-console-standalone/blob/master/src/Command/Test2Command.php][file (src) for example]]:

Thats all, command loader should detect this file and load it. You can use your command by running
=php bin/console say:nothing=.

You can put other commands in =src/Command=
directory try save content below as =[[https://github.com/exu/symfony2-console-standalone/blob/master/src/Command/TestCommand.php][src/Command/TestCommand.php]]=

and then run:
=bin/console say:mynamebitch Jacek=

You will get some nice colorized output.

*** Enjoy!