Download the PHP package twoixter/ansicolors without Composer

On this page you can find all versions of the php package twoixter/ansicolors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ansicolors

ansi::[colors] for PHP CLI

ansi::[colors] is a simple library for PHP CLI applications. Made for simplicity, it avoids complicated methods for ANSI code output.

By complicated methods I mean something like:

You get the point. I want to avoid a "FactorySingletonGenerator" to just print a red "E".


Installation

Just use Composer. Add this to your composer.json:

Or you just can download the lib/ansi.php file to your own source directory. Require it and you're ready to go.

Usage

ansi:[colors] uses a global Class. You don't need to instantiate it, just use it's static methods. If the name ansi in lower case collides with some other global class of your own, please rename your class. :-)

Example usage without arguments:

Note that you need to ansi::reset() if you don't use arguments or your text will be red forever, even when you exit the PHP script.

Alternatively, you can put some strings inside the method:

The string this is red will be printed in red and automatically reset to the previous console color.

Available colors

Available colors are the usual suspects: black, red, green, yellow, blue, magenta, cyan and white.

Use then as static methods to the ansi class:

...and so on. They return a string containing the ANSI escape sequences, you must output it yourself, nothing is automatically echoed to the console.

Uppercase and lowercase methods

The above eight color names are lowercase. It is on purpose. Lower case name colors are dull, the brighter ones are UPPERCASE or CamelCased. Example:

Background colors

You can not change the background color on its own, you must add also a foreground color using the following form:

The string Yep! will use a bright red foreground color over a white background. Background colors are all dull, Red_on_White has no effect, even when using all uppercase.

You can use all combinations of colors for foreground and background. Examples:

Named colors

ansi::[colors] supports color aliasing as named colors. Use ansi::define("name", "color"); to create a new named color.

Example:

Support for pipes

ansi:[colors] is smart enough to disable itself when piped. So you can do things like:

And you can be sure no ANSI codes will mangle your output. Perfect for logging to file for example, or using less to paginate.

License

Licensed under the MIT license -- http://opensource.org/licenses/MIT

If you like ansi::[colors], please send some cheers to my Twitter at @twoixter. If you find some bugs, please fork and send me a pull request, I'm open to suggestions except changing the class name ansi to uppercase Ansi... (Just kidding) :-)


All versions of ansicolors with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package twoixter/ansicolors contains the following files

Loading the files please wait ....