graviton/json-command-bundle

Symfony 扩展用于 graviton/json-command

v1.0.1 2019-06-18 11:19 UTC

This package is auto-updated.

Last update: 2024-09-18 14:00:15 UTC


README

Symfony 扩展用于 graviton/json-command

安装

步骤 1: 下载 Bundle

运行

composer require graviton/json-command-bundle

或者将其添加到你的 composer.json

"graviton/json-command-bundle": "*",

步骤 2: 启用 Bundle

然后,通过在项目的 app/AppKernel.php 文件中添加以下行来启用扩展

<?php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new \Graviton\JsonCommandBundle\JsonCommandBundle(),
        ];

        // ...
    }

    // ...
}

使用方法

注册新服务

<!-- app/config/services.xml -->
<service id="my.node.executor" class="%graviton.json_command.jsonexecutor.class%">
    <factory service="graviton.json_command.jsonexecutor.factory" method="createJsonExecutor"/>
    <argument>node</argument>
    <argument>array</argument>
    <argument type="collection">
        <argument>-type=general</argument>
    </argument>
</service>