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

SitePoint PHP Blog:
Symfony Console Beyond the Basics – Helpers and Other Tools
Sep 14, 2017 @ 16:12:42

The SitePoint PHP Blog has a new tutorial posted from author Claudio Ribeiro that takes you beyond the basics with the Symfony Console component, showing you how to use some of the helpers and other tools included in its functionality.

It’s undeniable how useful console commands can be when developing software. Not too long ago we re-introduced the Symfony Console component.

This component allows us to create structured and testable CLI commands. We created some simple commands and tested them; but when our commands become bigger and more complex, we need a different set of tools.

This is what we are going to look at today: advanced Symfony console tools.

He then walks you through the installation of the component via Composer and the initial creation of a "FizzBuzz" console command class (and other related classes). He then shows how to use several of the helpers:

  • the "question" helper to ask for user input
  • the "table" helper for outputting structured data
  • the "progress bar" helper to visually output progress of a task

There's also examples included showing how to call a command from inside a command and changing up color and style of the output.

tagged: tutorial symfony console advanced helpers command

Link: https://www.sitepoint.com/symfony-console-beyond-the-basics-helpers-and-other-tools/


Trending Topics: