rapotor/console-bundle

直接从应用程序执行 Symfony2 命令

安装: 78

依赖: 0

建议者: 0

安全: 0

星星: 26

关注者: 3

分支: 6

开放问题: 9

类型:symfony-bundle

v1.0 2012-06-05 07:38 UTC

This package is not auto-updated.

Last update: 2024-09-28 12:33:42 UTC


README

将使用 Sf2gen 命名空间进行未来项目。Sf2genConsoleBundle 将是其一部分。Sf2genConsoleBundle 允许您直接从应用程序执行控制台命令。界面加载方式与 WebProfilerBundle 相同。

特性

  • 命令自动完成
  • 命令历史记录

使用方法

而不是输入 php app/console list,您只需输入 list。点号是 list 的别名。

请看

Screenshot

Screenshot

Screenshot

安装

  1. 将此捆绑包添加到您的 vendor/ 目录中

    $ git submodule add git://github.com/RapotOR/ConsoleBundle.git vendor/bundles/Sf2gen/Bundle/ConsoleBundle

  2. 将 Sf2gen 命名空间添加到您的自动加载器中

    // app/autoload.php $loader->registerNamespaces(array( 'Sf2gen' => DIR.'/../vendor/bundles', // 其他命名空间 ));

  3. 将此捆绑包添加到您的应用程序内核的调试部分

    // app/ApplicationKernel.php public function registerBundles() { $bundles = array( // 所有捆绑包 );

       if (in_array($this->getEnvironment(), array('dev', 'test'))) {
           // previous bundles like WebProfilerBundle
           $bundles[] = new Sf2gen\Bundle\ConsoleBundle\Sf2genConsoleBundle();
       }
    
       return $bundles;
    

    }

  4. 将以下资源添加到您的 routing_dev.yml 中

    // app/config/routing_dev.yml _sf2gencdt: resource: "@Sf2genConsoleBundle/Resources/config/routing.yml" prefix: /_sf2gencdt

  5. 如果您使用的是 security 组件,则必须禁用防火墙

    app/config/config.yml

    security: firewalls: sf2gen: pattern: /_sf2gencdt/.* security: false

  6. 以下是完整的配置

    app/config/config.yml

    sf2gen_console: new_process: true # 使用新的 shell 进程来启动命令 toolbar: true # 在当前应用程序中显示工具栏 ; 要禁用以在第三方应用程序中使用。 local: true # 将当前应用程序添加到可用的应用程序列表中 ; 如果为 false,则排除当前应用程序。 all: false # 将添加所有具有控制台的应用程序,而无需在配置中使用 apps。 env: %kernel.environment% # 用于内核设置的 env apps: # 使用此来获得一个明确的列表。 - app - symfony-standard