PHP code example of web64 / laravel-cli-colors

1. Go to this page and download the library: Download web64/laravel-cli-colors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

web64 / laravel-cli-colors example snippets


use Web64\Colors\Facades\Colors;

Colors::red('Red Text');

Colors::light_blue('Light blue text');
Colors::bg_light_blue('Light blue background');

// config.php
return [
    'myStyle' => ['bold','blue', 'bg_white'],
    ...
];

Colors::myStyle('Bold blue text with white background');

// Laravel-style output
Colors::info('Green text');
Colors::question('Black text on light blue background');

// Model changed styles
Colors::created("Green bg to indicate model was created");
Colors::updated("Yellow bg to indicate model was updated");
Colors::deleted("Red bg to indicate model was deleted");


Colors::bold__underline__reverse__blue__bg_light_gray("Text..");

Colors::bold()->red('Bold red text');
Colors::underline()->blue('Underlined blue text');
Colors::italic()->green('Italic green text');
Colors::reverse()->default('Reversed default text and background color');

Colors::nobr()->red('U');
Colors::nobr()->white('S');
Colors::blue('A');

Colors::b__u__dgray__bg_lcyan('Text');
// Same as 
Colors::bold__underline__dark_gray__bg_light_cyan('Text');

colors('red', 'Hello World!');
colors('b__u__red', 'Hello World!');
colors(['bold', 'underline', 'red'], 'Hello World!');

// Random text colors:
Colors::rainbow('Text');

// Random background colors:
Colors::reverse()->rainbow('Text');
bash
php artisan vendor:publish --provider="Web64\Colors\ColorsServiceProvider" --tag="config"
bash
php artisan colors:test 
bash
php artisan colors:test --config