When we want to debug laravel stuff and running a *php artisan serve* on a terminal window, we would like to have a utility similar to printf in C, println in Java.. etc. This can be achieved by the following lines of code:

 $TERMINAL_PRINT = new \Symfony\Component\Console\Output\ConsoleOutput(2);
 $TERMINAL_PRINT->writeln('hello this is printed onto the terminal.');

 

Run your Laravel app and you can see something like below:

Screen Shot 2017-03-29 at 5.32.34 PM

Advertisements