PHPackages                             php-pmd/console - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. php-pmd/console

ActiveLibrary[CLI &amp; Console](/categories/cli)

php-pmd/console
===============

PHP CLI console(clio/clio)

0.0.1(5y ago)013MITPHPPHP &gt;=5.6

Since Jan 12Pushed 3y agoCompare

[ Source](https://github.com/php-pmd/console)[ Packagist](https://packagist.org/packages/php-pmd/console)[ RSS](/packages/php-pmd-console/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Console
=======

[](#console)

Console based on [Clio](https://github.com/nramenta/clio).

Console is a lightweight utility and helper classes for CLI applications.

It provides colored output, prompts, confirmation inputs, selections, background.

Installation
------------

[](#installation)

```
composer require php-pmd/console

```

PHP 5.4 is required. This library is developed on and is meant to be used on POSIX systems with the posix, pcntl, and sockets extensions loaded.

The Console class provides helpers for interactive command line input/output.

### Console::stdin($raw = false)

[](#consolestdinraw--false)

Waits for user input. If `$raw` is set to `true`, returns the input without right trimming for `PHP_EOL`.

### Console::input($prompt = null, $raw = false)

[](#consoleinputprompt--null-raw--false)

Asks the user for input which ends when the user types a `PHP_EOL` character. You can optionally provide a prompt string. If `$raw` is set to `true`, returns the input without right trimming for `PHP_EOL`.

### Console::stdout($text, $raw = false)

[](#consolestdouttext-raw--false)

Prints `$text` to STDOUT. The text can contain text color and style specifiers. This method detects whether the text is to be sent out to TTY or to a file through the use of shell redirection and acts accordingly, in the case of the latter, by stripping the text of all color and style specifiers.

If the second parameter is set to true, then it will print `$text` as is with all text color and style specifiers intact regardless of whether it's printing to TTY or to a file.

```
