PHPackages                             clio/clio - 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. clio/clio

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

clio/clio
=========

Lightweight utility and helper classes for CLI applications

0.1.8(12y ago)92289.5k↓63.6%8[1 PRs](https://github.com/nramenta/clio/pulls)3MITPHPPHP &gt;=5.3.2

Since Nov 17Pushed 12y ago7 watchersCompare

[ Source](https://github.com/nramenta/clio)[ Packagist](https://packagist.org/packages/clio/clio)[ RSS](/packages/clio-clio/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (10)Used By (3)

Clio
====

[](#clio)

Clio is a lightweight utility and helper classes for CLI applications. It provides colored output, prompts, confirmation inputs, selections, background processes, as well as a way to start and stop daemons.

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

[](#installation)

The prefered way to install Clio is through [composer](http://getcomposer.org/); the minimum composer.json configuration is:

```
{
    "require": {
        "clio/clio": "0.1.8"
    }
}

```

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.

Console
-------

[](#console)

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.

```
