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
- Host: GitHub
- URL: https://github.com/exu/symfony2-console-standalone
- Owner: exu
- Created: 2013-05-10T16:18:10.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2014-01-10T11:29:35.000Z (over 12 years ago)
- Last Synced: 2025-03-26T16:29:24.292Z (over 1 year ago)
- Language: PHP
- Size: 180 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
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!