定制 phico/cli 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

phico/cli

Composer 安装命令:

composer require phico/cli

包简介

Lightweight terminal support for Phico

README 文档

README

Lightweight terminal support for Phico

Installation

Using composer

composer require phico/cli

Usage

CLI provides a handful of useful methods for terminal interaction.

It is useful when creating your own commands.

Cli

Write a line to the terminal

$input = write('Hello world');
Continue on the same line
write(', this is Phico', $newline = false);
Colour support

Use error(), info(), success(), warning() to use different highlight colours.

Request user input

$input = prompt('What is your name? ');
Limit choices in response
// only one of red, blue or green is accepted
$input = prompt('What is your favourite colour? ', [
    'red',
    'blue',
    'green
]);

Write a title

$input = title('This will be underlined');

// This will be underlined
// =======================

Draw a table

$data = [
    ['Kermit', 'Green'],
    ['Fozzy Bear', 'Brown'],
    ['Miss Piggy', 'Pink'],
    ['Gonzo', 'Blue'],
];
$headings = [ 'Name', 'Colour' ];

$input = table($data, $headings);

Args

Args handles terminal inout by organising it into flags (short or long), arguments and values.

Flags

Specify single character flags with a single dash

phico -v

Multiple single flags can be set with a single dash

phico -vrt

Use has() to check if a flag is set

phico -vrt
$args->has('v'); // true
$args->has('r'); // true
$args->has('t'); // true

$args->has('a'); // false

Issues

CLI is considered feature complete, however if you discover any bugs or issues in it's behaviour or performance please create an issue, and if you are able a pull request with a fix.

Please make sure to update tests as appropriate.

For major changes, please open an issue first to discuss what you would like to change.

License

BSD-3-Clause

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2024-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固