承接 apolinux/cmdcli 相关项目开发

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

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

apolinux/cmdcli

最新稳定版本:v0.2.4

Composer 安装命令:

composer require apolinux/cmdcli

包简介

Parse CLI arguments and options

README 文档

README

Is a library created to parse command line options and arguments. This library reads command line string parts and map each option with an object. Also it can shows the help using option description.

Installation

composer require apolinux/cmdcli

Example

<?php

use Apolinux\CmdCli\CmdCli;

require_once __DIR__ . '/vendor/autoload.php';

$cmd_cli = new CmdCli('A command name');

$cmd_cli->addOpt(
  'xml',  // name of option
  CmdCli::TYPE_SINGLE_OPT,  // data type
  'is an xml option', // description
  'x', // short option, '-x'
  '--xml', // long option, '--xml' 
  false  ,    // require a parameter or not
  false      // is optional or not
)
->addArg(
  'logname' , // argument name
  'is a log name', // description
  true,  // is optional
);

$input = ['cmdname','-abc','-y','--sign','-x','file123.log'];

$text=$cmd_cli->parse($input);

// get options
$options = $cmd_cli->getParsedOpts();

// get arguments
$args = $cmd_cli->getParsedArgs();

// to know if one argument is defined. It shows true
var_dump($options['xml']);

// get argument value. It shows 'file123.log'
echo $args['logname'];

// other options not defined before are ignored

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固