Download the PHP package kielabokkie/laravel-fancy-console without Composer
On this page you can find all versions of the php package kielabokkie/laravel-fancy-console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kielabokkie/laravel-fancy-console
Files in kielabokkie/laravel-fancy-console
Package laravel-fancy-console
Short Description A trait to give your console commands some extra fancy output
License MIT
All versions of laravel-fancy-console with dependencies
Informations about the package laravel-fancy-console
Fancy Console for Laravel
Fancy Console for Laravel provides a FancyConsole
trait that gives you a few extra fancy styled console outputs to compliment the already useful default Laravel ones.
Requirements
- PHP >= 7.2
- Laravel 5.8 and up
Installation
Install the package via composer:
Usage
Firstly you'll have to add the FancyConsole
trait to your command:
Success and fail messages
To make it easier to style success and fail messages you will have access to the following methods:
Which gives you the following output:
Loading indicator
Laravel already comes with an easy progress bar but if you want to show progress in a different way you can use the dot loading indicator:
The code above will output 100 dots on the same line. If you want to restrict the number of dots on a line you can set the dot width:
Now it will jump to the next line once the number of dots reach a multiple of 40.
If you know the total number of loading dots your command will be outputting you can set the total dots and the output will show you the current progress and total per line.
Lastly, if you would like to use a different character instead of a dot, you can pass it as a parameter: