Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Knp University:
Fun with Symfony's Console Component
Oct 06, 2015 @ 15:26:41

In a post to the Knp University blog they show you some of the fun you can have with the Symfony Console component in a single file including a few lesser known (and lesser used) features.

One of the best parts of using Symfony's Console component is all the output control you have to the CLI: colors, tables, progress bars etc. Usually, you create a command to do this. But what you may not know is that you can get to all this goodness in a single, flat PHP file.

They walk you through the creation of a ConsoleOutput object with a simple writeln output of a formatted method. They briefly mention the handling for changing up the output (OutputFormatter and OutputFormatterStyle) before getting into something a bit more complex - table layouts. They end the post with an interesting "hidden" feature inside the component, the Symfony track progress bar (animated gif included to show the end result).

tagged: symfony console component feature pretty output table track progressbar

Link: http://knpuniversity.com/blog/fun-with-symfonys-console


Trending Topics: