承接 dbemfica/phpcli 相关项目开发

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

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

dbemfica/phpcli

Composer 安装命令:

composer require dbemfica/phpcli

包简介

Aplication PHP CLI

README 文档

README

This is a lib simple to create commands in PHP using Command Line Interface

Create APP

Create a file index.php with this content

<?php

require_once "vendor/autoload.php";

$command = new \PHPCLI\FirstCommand();

$app = new \PHPCLI\App($argv);
$app->addCommand($command);
$app->run();

After run this script php index.php

Create Command

<?php

use PHPCLI\Command;

class FirstCommand extends Command
{
    public $name = "First";
    public $description = "Command Example";

    public $arguments = [
        'name'
    ];

    public function execute()
    {
        echo "First command";
    }
}

Passing arguments to the command

os argumentos são pssando passados pelo bash com o prefixo --. Example php index.php --name Diogo

<?php

use PHPCLI\Command;

class FirstCommand extends Command
{
    public $name = "First";
    public $description = "Command Example";

    public $arguments = [
        'name'
    ];

    public function execute()
    {
        $name = $this->getArgument('name');
        echo "Hello ".$name.PHP_EOL;
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固