Download the PHP package asamaru7/ansi-php without Composer

On this page you can find all versions of the php package asamaru7/ansi-php. 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 ansi-php

ANSI PHP

Build Status Source Version Downloads License

ANSI Control Functions and ANSI Control Sequences for PHP CLI Apps

Built by Bramus! - https://www.bram.us/

About

bramus/ansi-php is a set of classes to working with ANSI Control Functions and ANSI Control Sequences on text based terminals.

(Sidenote: An “ANSI Escape Sequence” is a special type of “ANSI Control Sequence” which starts with the ESC ANSI Control Function. The terms are not interchangeable.)

Features

When it comes to ANSI Control Functions bramus/ansi-php supports:

When it comes to ANSI Escape Sequences bramus/ansi-php supports:

Other Control Sequences – such as moving the cursor – are not (yet) supported.

An example library that uses bramus/ansi-php is bramus/monolog-colored-line-formatter. It uses bramus/ansi-php's SGR support to colorize the output:

Monolog Colored Line Formatter

Prerequisites/Requirements

Installation

Installation is possible using Composer

Usage

The easiest way to use ANSI PHP is to use the bundled Ansi helper class which provides easy shorthands to working with bramus/ansi-php. The Ansi class is written in such a way that you can chain calls to one another.

If you're feeling adventurous, you're of course free to use the raw ControlFunction and ControlSequence classes.

Quick example

See more examples further down on how to use these.

Concepts

Since v3.0 bramus/ansi-php uses the concept of writers to write the data to. By default a StreamWriter writing to php://stdout is used.

The following writers are provided

The Ansi helper class functions

Core functions:

ANSI Control Function shorthands:

These shorthands write a Control Character to the writer.

SGR ANSI Escape Sequence shorthands:

These shorthands write SGR ANSI Escape Sequences to the writer.

IMPORTANT: Select Graphic Rendition works in such a way that text styling you have set will remain active until you call nostyle() or reset() to return to the default styling.

ED ANSI Escape Sequence shorthands:

These shorthands write ED ANSI Escape Sequences to the writer.

EL ANSI Escape Sequence shorthands:

These shorthands write EL ANSI Escape Sequences to the writer.

Extra functions

Examples

The Basics

NOTE: As no $writer is passed into the constructor of \Bramus\Ansi\Ansi, the default StreamWriter writing to php://stdout is used.

Using a FlushableWriter

Flushable Writers are writers that cache the data and only output it when flushed using its flush() function. The BufferWriter and ProxyWriter implement this interface.

Chaining

bramus/ansi-php's wrapper Ansi class supports chaining.

Styling Text: The Basics

IMPORTANT Select Graphic Rendition works in such a way that text styling you have set will remain active until you call nostyle() or reset() to return to the default styling.

Styling Text: Colors

Colors, and other text styling options, are defined as contants on \Bramus\Ansi\ControlSequences\EscapeSequences\Enums\SGR.

Foreground (Text) Colors

Background Colors

Pass one of these into $ansi->color() and the color will be set.

To set the foreground and background color in one call, pass them using an array to $ansi->color()

Using the raw classes

As all raw ControlFunction and ControlSequence classes are provided with a __toString() function it's perfectly possible to directly echo some bramus/ansi-php instance.

To fetch their contents, use the get() function:

Unit Testing

bramus/ansi-php ships with unit tests using PHPUnit.

Unit tests are also automatically run on Travis CI

License

bramus/ansi-php is released under the MIT public license. See the enclosed LICENSE for details.

ANSI References


All versions of ansi-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 asamaru7/ansi-php contains the following files

Loading the files please wait ....