2017 © Pedro Peláez
 

library consoleoutput

Laravel Console Output Trait

image

ottosmops/consoleoutput

Laravel Console Output Trait

  • Tuesday, May 22, 2018
  • by ottosmops
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 27 % Grown

The README.md

A trait to split Symfony/Laravel Console Output to stdout and stderr

GitHub license Latest Stable Version Packagist Downloads, (*1)

A trait you can pull into your Laravel-Commands (use \Ottosmops\Consoleoutput\ConsoleOutputTrait;). This should help to make the commands behave more like you would expect ("Silence is golden."). The effect: Errors and warnings are sent to stderr. Other messages are sent to stdout only if you call the command with -vor -vv. You can overwrite this when you call the methods. Just set another $verbosityLevel., (*2)

The trait is inspired by this blog-post: http://fideloper.com/laravel-symfony-console-commands-stderr, (*3)

Installation

composer require ottosmops/consoleoutput

Usage

Just pull in the trait, and you are ready to go., (*4)

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.");
     }
}

Methods

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

Version 1.1

To avoid errors, the methods check if you call them from the command line. Otherwise the Laravel-Log-Methods are called., (*5)

License

The MIT License (MIT). Please see License File for more information., (*6)

The Versions

22/05 2018

dev-master

9999999-dev https://github.com/ottosmops/consoleoutput

Laravel Console Output Trait

  Sources   Download

MIT

The Requires

 

The Development Requires

by ak

laravel console output anton ottosmops

22/05 2018

v1.1.0

1.1.0.0 https://github.com/ottosmops/consoleoutput

Laravel Console Output Trait

  Sources   Download

MIT

The Requires

 

The Development Requires

by ak

laravel console output anton ottosmops

16/05 2018

v1.0.0

1.0.0.0 https://github.com/ottosmops/consoleoutput

Laravel Console Output Trait

  Sources   Download

MIT

The Requires

 

The Development Requires

by ak

laravel console output anton ottosmops