定制 daijulong/console 二次开发

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

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

daijulong/console

Composer 安装命令:

composer require daijulong/console

包简介

A simple, lightweight console for php

README 文档

README

A simple, lightweight console for php

中文版本

Require

  • php: >= 5.4

Install

Via Composer

$  composer require daijulong/console

composer.json

"daijulong/console": "^1.1"

Usage

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

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

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

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固