PHPackages                             daijulong/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. daijulong/console

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

daijulong/console
=================

A simple, lightweight console for php

1.1.0(7y ago)0601MITPHPPHP &gt;=5.4

Since Jul 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/daijulong/console)[ Packagist](https://packagist.org/packages/daijulong/console)[ RSS](/packages/daijulong-console/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (1)

Console
=======

[](#console)

A simple, lightweight console for php

[中文版本](README_CN.md)

Require
-------

[](#require)

- php: &gt;= 5.4

Install
-------

[](#install)

Via Composer

```
$  composer require daijulong/console
```

composer.json

```
"daijulong/console": "^1.1"
```

Usage
-----

[](#usage)

### Output

[](#output)

Create a console instance

```
$console = \Daijulong\Console\Console::instance();
```

Print a message at the console

```
$console->text('I am a message!');
```

Print a message with a foreground color and a background color

```
$console->text('I am a message with red foreground color and yellow background color.', 'red', 'yellow');
```

> You can get all supported colors from `Daijulong\Console\Color\Foreground::class` and `Daijulong\Console\Color\Background::class` .

Print a message in a shortcut

```
$console->success('I am a success message.');
```

> This will print a line of green text. Other similar methods are `error`, `warning`, `alert` and more.

### Input

[](#input)

Ask a question and get the answer

```
$name = $console->ask('Who are you?');
```

> You can use second parameter as the default value. If there are third parameter equal to `true` , the answer can not be empty, even if the default value is set.

Often, you just need to answer yes or no.

```
$bool = $console->yesOrNo('Are you going to give me your money?');
```

> The console will be kept asking until you answer yes or no. Similarly, if any, the second parameter is the default value.

### Other

[](#other)

Coloring string

```
$console->colored('I am a message with red foreground color and yellow background color.', 'red', 'yellow');
```

> Similar to `text`, it does not output directly, which is very useful in displaying a variety of styles in a piece of content.

License
=======

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2842d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a269645782557daab88eb3bcc2769c59952446bbba11d609065818f0c0a79de1?d=identicon)[daijulong](/maintainers/daijulong)

---

Top Contributors

[![daijulong](https://avatars.githubusercontent.com/u/2356884?v=4)](https://github.com/daijulong "daijulong (7 commits)")

### Embed Badge

![Health badge](/badges/daijulong-console/health.svg)

```
[![Health](https://phpackages.com/badges/daijulong-console/health.svg)](https://phpackages.com/packages/daijulong-console)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
