New in Symfony 2.4: Better Console Integration with third-party Tools
Did you know that the Symfony console component provides tools to ease its integration in third-party tools? Out of the box, the Symfony console component gives all some tools to auto-discover register commands, their arguments, their help, and more:
1 2 3 4 5
$ ./app/console list --format=xml $ ./app/console list --format=json $ ./app/console help --format=xml $ ./app/console help --format=json
This feature (which was already available in symfony1) is used by many text editors and IDEs to provide a GUI for Symfony commands.
Symfony 2.4 goes one step further by providing the same
--format option on
some debug commands like
Want to get all registered routes in a Symfony 2.4 app? Run:
$ ./app/console router:debug --format=xml
Want to learn more about a specific route?
$ ./app/console router:debug homepage --format=xml
And the same goes for the Container. Here is how to get all registered services:
$ ./app/console container:debug --format=xml
You can restrict to only one service:
$ ./app/console container:debug twig --format=xml
And getting defined parameters is as easy as running:
$ ./app/console container:debug --parameters --format=xml
Don't like XML? Use
json instead of
xml for the format!
Last, but not the least, the
md format (Markdown) automatically generate
documentation for your routes and services:
$ ./app/console router:debug --format=md $ ./app/console container:debug --format=md
How will you use these new possibilities? Which tool are you going to create to ease your job?
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.