jralph / Laravel-Artisan-Colours by jralph

50
3
2
Package Data
Maintainer Username: jralph
Maintainer Contact: joe@josephralph.co.uk (Joseph Ralph)
Package Create Date: 2014-06-16
Package Last Update: 2014-06-24
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 03:00:55
Package Statistics
Total Downloads: 50
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 3
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel Artisan Colours

A simple extension of the laravel Illuminate\Console\Command object to add some colour functionality.

Laravel's artisan already has some colour features using the info, error, comment and line methods, but it does not give you all of them. This package lets you use all of the available ANSI colours with the line method.

Install

Installation is nice and simple using composer.

Add the package to your composer.json file.

"require": {
    ...
    "jralph/laravel-artisan-colour": "1.*"
}

Once done, run a composer update and follow the setup below.

Setup

Setup is nice and simple and only requires two steps.

  1. Add 'Jralph\LaravelArtisanColour\LaravelArtisanColourServiceProvider', to your app/config/app.php providers array.
  2. Make sure that any classes you want to use the colours extend Jralph\LaravelArtisanColour\Console\Command.

Usage

Using the colours is easy and straight forward.

Colours are only available on the $this->line(); method as the others already have colours associated with them.

Syntax:

- __With Background__: `$this->line('This is some text.', 'text_colour:background_colour');`
- __Only Test__: `$this->line('This is some text.', 'text_colour');`

Available Colours

Below is a list of all available text colour and background colours.

  • Black
  • White
  • Red
  • Green
  • Blue
  • Yellow
  • Cyan
  • Magenta

Using a combination of the above colours with the package will give you the desired text/background colours.

Optional Config

The package also includes optional configuration that you may change if desired.

Publish the config: php artisan config:publish jralph/LaravelArtisanColour

config.php

This file contains a single option. Should the colours be output when using windows.

If this option is true, the package will output the ansi colour codes. If you do not have your command line setup to read these codes and set the colours, then you may want to set this option to false.

ansi.php

This file contains settings for all of the colours.

In this file you can set the default text colour (white) and default background colour (black).