chipslays/clify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

chipslays/clify

Composer 安装命令:

composer require chipslays/clify

包简介

Developing CLI applications in PHP.

README 文档

README

Developing CLI applications in PHP.

Installation

$ composer require chipslays/clify

Usage

Place this code in app file:

#!/usr/bin/env php
<?php 

use Clify\Cli;

require 'vendor/autoload.php';

$cli = new Cli;

print_r($cli->getArgs()->toArray());

Run app file in Terminal:

$ php app --data "hello world" --save "./path/to/file.txt" -o --append -val="test" --some="spaces here" lonely

Terminal output:

Array
(
    [data] => hello world
    [save] => ./path/to/file.txt
    [o] => 1
    [append] => 1
    [val] => test
    [some] => spaces here
    [lonely] => 1
)
use Clify\Cli;

require 'vendor/autoload.php';

out('text');
error('text');
success('text');
info('text');
warning('text');

$cli->get('some_arg', 'default value');

Terminal output (with new line):

use Clify\Cli;

require 'vendor/autoload.php';

echo Cli::out("{blue}Blue text");

Colorize text output:

use Clify\Cli;

require 'vendor/autoload.php';

echo Cli::colorize("{blue}Blue text{reset}");
echo Cli::colorize("{black}{bg:yellow} Black text on Yellow background{reset}");

// At the end, it will automatically add {reset}
echo Cli::colorizeLine("{blue}Blue text");

Available colors:

$list = [
    "{reset}" => "\e[0m",
    "{black}" => "\e[0;30m",
    "{white}" => "\e[1;37m",
    "{dark_grey}" => "\e[1;30m",
    "{dark_gray}" => "\e[1;30m",
    "{light_grey}" => "\e[0;37m",
    "{light_gray}" => "\e[0;37m",
    "{red}" => "\e[0;31m",
    "{light_red}" => "\e[1;31m",
    "{green}" => "\e[0;32m",
    "{light_green}" => "\e[1;32m",
    "{brown}" => "\e[0;33m",
    "{yellow}" => "\e[1;33m",
    "{blue}" => "\e[0;34m",
    "{magenta}" => "\e[0;35m",
    "{light_magenta}" => "\e[1;35m",
    "{cyan}" => "\e[0;36m",
    "{light_cyan}" => "\e[1;36m",
    "{bg:black}" => "\e[40m",
    "{bg:red}" => "\e[41m",
    "{bg:green}" => "\e[42m",
    "{bg:yellow}" => "\e[43m",
    "{bg:blue}" => "\e[44m",
    "{bg:magenta}" => "\e[45m",
    "{bg:cyan}" => "\e[46m",
    "{bg:light_grey}" => "\e[47m",
    "{bg:light_gray}" => "\e[47m",
];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固