承接 laranail/console 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laranail/console

Composer 安装命令:

composer require laranail/console

包简介

A Rich-class console toolkit for Laravel — fluent output formatter, spinners, progress bars, boxes, trees and tables, plus a fluent prompts/forms layer with validators.

README 文档

README

Latest version on Packagist Tests Static analysis License: MIT

A Rich-class console toolkit for Laravel. One package, two namespaces:

  • Console\Tools — terminal output: a fluent formatter, spinners, flavoured progress bars, boxes, trees, tables, banners, gauges, sparklines, a multi-task progress widget, plus an enhanced Artisan command base.
  • Console\Prompter — terminal input: a fluent wrapper over laravel/prompts with a form builder and 25+ validators.

Targets PHP ^8.3 (8.3–8.5) on Laravel ^13.

Install

composer require laranail/console

The service provider, the Console and Prompter facades, and the global prompter() helper are auto-discovered. Publish the config and language files if you want to customise them:

php artisan vendor:publish --tag=console-config
php artisan vendor:publish --tag=console-lang

Quick start

use Simtabi\Laranail\Console\Facades\Console;

// Output
echo Console::status()->success('Build complete');
echo Console::box(['Name: app', 'Env:  prod'])->title('Config')->render();
echo Console::tree('project')->child('src', fn ($t) => $t->child('Console'))->render();
echo Console::gauge(72, 100)->label('Disk')->showValue()->render();

Console::spinner('Compiling…')->run(fn () => compile());

$bar = Console::progress(max: count($items))->format('detailed')->glyphs('blocks');
$bar->start();
foreach ($items as $item) { process($item); $bar->advance(); }
$bar->finish();

// Multi-task progress (exits non-zero if any task fails)
$tasks = Console::tasks();
$tasks->task('Compile', 100)->advance(100)->succeed();
exit($tasks->finish());

// Input
$name = Console::prompter()->text('Your name', required: true)->getResult();

Console::ui() returns the underlying fluent ConsoleUIFormatter; Console::prompter() returns the shared Prompter. The two sub-domains are fully decoupled — they only meet in the Console aggregator.

Formatter and status strings carry Symfony Console markup (e.g. <fg=green>…</>). Write them through a console output — $output->writeln(…) or a command's $this->line(…) — so colour renders on a TTY and is stripped cleanly when piped. Plain widgets (box, tree, table, gauge…) echo fine.

Security & portability

  • All rendered text is stripped of terminal control characters (no ANSI/\r output spoofing); terminal hyperlinks are limited to an allow-list of URL schemes.
  • Validators are total — non-string input returns an error rather than throwing.
  • Unicode glyphs and colour degrade gracefully: capabilities are detected from the terminal and honour NO_COLOR, FORCE_COLOR, TERM and locale; ASCII fallbacks are used when Unicode is unavailable.
  • Signal handling is guarded by ext-pcntl, so commands run on Windows too.

Documentation

Page What it covers
Installation Requirements, install, publishing
Architecture Umbrella, sub-domains, the manager
Configuration Every config/console.php key
Internationalization Translating console strings
Output formatter Colours, badges, status, links
Output widgets Spinner, progress, box, tree, table, gauge…
Commands The Artisan command base + services
Runners Conditional console execution
Notifications The console channel
Observers & events Command lifecycle hooks
Prompts & forms The Prompter, forms and validators

License

MIT © Simtabi LLC. See LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固