定制 seiffert/console-extra-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

seiffert/console-extra-bundle

最新稳定版本:1.0.0

Composer 安装命令:

composer require seiffert/console-extra-bundle

包简介

This bundle adds support for commands defined as DI services

README 文档

README

This bundle adds support for commands defined as DI services.

Build Status

Setup

Require the package via composer:

composer.json:

    "require": {
        ...
        "seiffert/console-extra-bundle": "1.0.0",
        ...
    }

Activate the bundle in your AppKernel:

app/AppKernel.php:

    public function registerBundles()
    {
        $bundles = array(
            ...
            new Seiffert\ConsoleExtraBundle\SeiffertConsoleExtraBundle(),
            ...
        );
        ...
    }

Disable automatic command registration in each of your bundles defining commands by overriding Bundle::registerCommands() with an empty implementation:

src\You\YourBundle\YouYourBundle.php:

    public function registerCommands(Application $application)
    {
        // commands are registered by SeiffertConsoleExtraBundle
    }

Usage

After following the above setup steps, you can start defining all your commands as services. Command services are being identified by a special tag console.command:

src\You\YourBundle\Resources\config\services.yml:

parameters:
    acme_demo.test_command.class: Acme\DemoBundle\Command\TestCommand

services:
    acme_demo.test_command:
        class: %acme_demo.test_command.class%
        tags:
            - { "name": "console.command" }

Your commands will be added to the dependency injection container. This enables you to write commands that have their dependencies injected and therefore are truly unit-testable.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: CC-BY-SA-3.0
  • 更新时间: 2012-12-08