Download the PHP package bebat/console-color without Composer

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

Console Color

Latest Stable Version Required PHP Version Acceptance Test Status Code Coverage

Console Color is a lightweight PHP 8.1+ library for adding color & other styles to text in the command line.

Installation

The Console Color library can be installed via Composer:

Basic Usage

To apply style to a text you need an instance of BeBat\ConsoleColor\Style. With that you can apply a style object to some text:

The Style class will try to determine if console output can be styled automatically (more details on this can be found in the Environment Variables section below). By default, it looks at STDOUT and checks if it is a TTY. If you are using a different output type (such as a php:// I/O stream) you may pass that to Style() to have it determine if that stream supports styling:

You may use the force() method to make Style always apply styles to text, regardless of whether it thinks the output resource supports it:

Environment Variables

In addition to checking if STDOUT is a TTY, Style will look at several environment variables to determine if styles should be applied, and what level of support the user's terminal has for styles.

Included Styles

Style::apply() accepts an instance of StyleInterface, and Console Color includes a number of styles that implement this interface.

To see what styles your terminal supports and what they look like, run the included sample.php file.

Basic Styles

Style\Text, Style\Underline, Style\Color, and Style\BackgroundColor are backed enumerations which helps to make Console Color's API extremely clean. These styles have the broadest support in most terminals (with some exceptions).

Text

Underline

Custom underline styles are not widely supported but some terminals do include them. Most, if not all, will fall back on just displaying a single underline.

Foreground & Background Color

Style\Color and Style\BackgroundColor both support the same values and have an identical API.

256 & True Color

Most terminal programs support 256 color output, and many now also support 24-bit "true" colors. Console Color can apply those colors to the foreground, background, or underline color through the Style\Color256 and Style\ColorRGB classes.

Composite Styles

It's possible to apply more than one style to your text by using the Style\Composite() class. For example, to apply color to both the foreground and background:

Style\Composite() is also required if you want to add color to an underline:

Style\Composite() can actually take as many styles as you need to apply:


All versions of console-color with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 bebat/console-color contains the following files

Loading the files please wait ....