PHP code example of ottosmops / consoleoutput

1. Go to this page and download the library: Download ottosmops/consoleoutput 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/ */

    

ottosmops / consoleoutput example snippets

 
class TestCommand extents Illuminate\Console\Command
{
     use \Ottosmops\Consoleoutput\ConsoleOutputTrait;
     
     ...
     
     public function handle()
     {
        $this->info("This is only an info message."); // This message is only shown, if you call the command with '-v'. 
        $this->error("Here comes the error.");
     }
}

 
debug($message, $verbosityLevel = 'vv')     // black output
info($message, $verbosityLevel = 'v')       // blue output
success($message, $verbosityLevel = 'v')    // green
warn($message, $verbosityLevel = 'normal')  // orange
error($message, $verbosityLevel = 'normal') // red
fatal($message, $verbosityLevel = 'normal') //red and exits