承接 ordinary/command 相关项目开发

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

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

ordinary/command

最新稳定版本:2.3.0

Composer 安装命令:

composer require ordinary/command

包简介

Library used to normalize the structure of files, functions, and classes intended to be ran from a shell.

README 文档

README

Getting Started

Install using composer.

composer require ordinary/command

Examples

Directly in executable file

Create the class.

class MyCommand extends \Ordinary\Command\Command
{
    public function run() : int {
        // do something
        return 0; // int 0-255 exit status
    }
    
    public function showHelp() : void {
        fwrite($this->stdout(), <<<HELP
        My Help Content
        HELP);
    }
    
    public function beforeExecute() : ?int {
        // do stuff before help screen and before run
        return null; // return null to continue or int error status for early exit
    }
}

Make the executable file with execute permissions.

#!/usr/bin/env php
<?php
## my-cmd.php
use Ordinary\Command\CommandExec;
use Ordinary\Command\Command;

$exec = new CommandExec();

/** @var Command $cmd */
$cmd = new MyCommand();

exit($exec->execute(
    $cmd->withArgs($_SERVER['argv'])
        ->withStreams(STDIN, STDOUT, STDERR)
));

Run the file

./my-cmd.php

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固