承接 strukt/console 相关项目开发

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

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

strukt/console

最新稳定版本:1.0.0

Composer 安装命令:

composer require strukt/console

包简介

Strukt CLI Console

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

This is a console framework that utilises DocBlock to parse command description and format.

Block Spaces (IMPORTANT)

This package uses DocBlock to generate your commands. The DocBlock must be in single spaces and NOT tabs. Be conservative with the spaces and don't leave any that are unnecessary otherwise the commands will not work.

Usage

Sample Command:

namespace Command;

use Strukt\Console\Input;
use Strukt\Console\Output;
use \Strukt\Console\Command as AbstractCommand;

/**
* mysql:auth          MySQL Authentication
* 
* Usage:
*   
*      mysql:auth <database> --username <username> --password <password> [--host <127.0.0.1>]
*
* Arguments:
*
*      database  MySQL database name - optional argument
* 
* Options:
* 
*      --username -u   MySQL Username
*      --password -p   MySQL Password
*      --host -h       MySQL Host - optional default 127.0.0.1
*/
class MySQLAuth extends AbstractCommand{ 

	public function execute(Input $in, Output $out){

		$out->add(sprintf("%s:%s:%s", 
							$in->get("database"), 
							$in->get("username"), 
							$in->get("password")));
	}
}

Add this in your executable file:

#!/usr/bin/php
<?php
$app = new Strukt\Console\Application("Strukt Console");
$app->add(new Command\MySQLAuth);
$app->run($_SERVER["argv"]);

Call command:

php console mysql:auth payroll -u root -p p@55w0rd

Prompt for input and masked input, you may but need not describe promted input in command docblock:

...
//prompt for input
$username = $in->getInput("Username:");
$nickname = $in->getInput("Nickname:");
//masked input
$password = $in->getMaskedInput("Password:");
$cpassword = $in->getMaskedInput("Confirm Password:");
...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固