承接 mortenscheel/php-inquirer 相关项目开发

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

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

mortenscheel/php-inquirer

最新稳定版本:v0.2

Composer 安装命令:

composer require mortenscheel/php-inquirer

包简介

Beautiful command-line prompts for PHP

README 文档

README

Latest Version on Packagist Total Downloads

PHP Inquirer

Beautiful interactive CLI prompts for PHP, based on the Rust inquire crate.

Demo

$name = Text::make()->prompt('Name')->placeholder('John Doe')->run();
$password = Password::make()->prompt('Password')->confirm()->run();
$birthday = Date::make()->prompt('Birthday')->maxDate(date('Y-m-d'))->run();
$whitespace = Select::make()->prompt('Indentation')->options(['Tabs', 'Spaces'])->run();
$hobbies = MultiSelect::make()->options(['Programming', 'Music', 'Cooking'])->initial(['Programming'])->run();
$bio = Editor::make()->prompt('Your Bio')->hint('Close editor when finished')->run();
$confirm = Confirm::make()->prompt('Proceed')->default(true)->run();

echo json_encode(compact('name', 'password', 'birthday', 'whitespace', 'hobbies', 'bio', 'confirm'), JSON_PRETTY_PRINT);

About

This is a simple proof of concept. I like the interactive prompts provided by the inquire crate, and I wanted to see what it took to use them in PHP CLI scripts.

This package includes a simple Rust cli app, pre-compiled for Linux, Mac and Windows. The PHP library is a simple wrapper that calls the rust app using exec(). I wanted to use symfony/process, but I couldn't find a way to make it fully interactive, while also being able to capture the output and exit code.

Caveat about the Editor prompt: By default it uses the editor defined in EDITOR or VISUAL (falls back to nano). Unfortunately this wrapper doesn't support terminal editors, but using a GUI editor like vscode does work. To use VS Code as the editor, either export VISUAL=code or run the editor with ->program('code').

If you have suggestions, please open an issue or submit a PR.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固