xervice/console 问题修复 & 功能扩展

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

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

xervice/console

最新稳定版本:2.1.1

Composer 安装命令:

composer require xervice/console

包简介

README 文档

README

Scrutinizer Code Quality Code Coverage

Console service based on symfony console for Xervice.

Installation

composer require xervice/console

Configuration

There is nothing to configure. But to add your commands, you have to extend the console module and overwrite "getCommandList" method in the dependency provider.

<?php

namespace App\Console;

use Xervice\Console\ConsoleDependencyProvider as XerviceConsoleDependencyProvider;

class ConsoleDependencyProvider extends XerviceConsoleDependencyProvider
{
    /**
     * @return array
     */
    protected function getCommandList(): array
    {
        return [
            new MyCommand()
        ];
    }
}

Usage

vendor/bin/xervice <command>

New Command

<?php

namespace App\MyModule\Communication\Console\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Xervice\Console\Business\Model\Command\AbstractCommand;

/**
 * @method \App\MyModule\Business\MyModuleFacade getFacade()
 * @method \App\MyModule\Communication\MyModuleCommunicationFactory getFactory()
 */
class MyCommand extends AbstractCommand
{
    /**
     * @throws \Symfony\Component\Console\Exception\InvalidArgumentException
     */
    protected function configure(): void
    {
        $this
            ->setName('mymodule:mycommand')
            ->setDescription('Command description');
    }

    /**
     * @param \Symfony\Component\Console\Input\InputInterface $input
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     *
     * @return int|void
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
     */
    public function run(InputInterface $input, OutputInterface $output)
    {
        $this->getFacade()->runMyCommand($output);
    }

}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-18