A progress bar is an excellent way to have some feedback when you are writing and running long process using Laravel commands.
TL;DR Using the output object, we can start, advance and stop the Progress Bar.
According to the Laravel official documentation, this is only what you need to create a progress bar:
Pretty straight forward, although you can use a different approach to avoid repeating the same code over and over.
Creating ProgressBarCallback trait
The following trait has a method that receives two arguments, a
countable object and a
callback and what it does is to create the progress bar, then run the given callback for each one of the items in the
Here you can see a dummy example.
You can learn more about the Laravel Artisan Console by reading the official documentation
I hope you like it.
Do you have any tips and tricks to share? Please reach out on Twitter.