daanbiesterbos/command-extra-bundle

这是一个最小的symfony扩展包,用于向symfony命令添加功能。

v1.0.1 2021-04-16 18:04 UTC

This package is auto-updated.

Last update: 2024-09-19 23:36:54 UTC


README

Build CommandExtraBundle Latest Stable Version Total Downloads

安装

该扩展包可在Packagist上找到。您可以使用Composer进行安装。

composer require daanbiesterbos/command-extra-bundle

步骤2:启用扩展包

将扩展包添加到config/bundles.php

return [
    DaanBiesterbos\CommandExtraBundle\CommandExtraBundle::class => ['all' => true],
];

步骤3:配置扩展包

最后,配置扩展包

# config/packages/command_extra.yaml
command_extra:
  aliases:
    # Example 1:
    # Register alias to run a non symfony command.
    ps:
      name: 'ps'
      description: 'Shorthand example of a non symfony command.'
      execute: 'ps -aux'  # This shorthand is for non-symfony commands only.
    # Example 2
    # Register alias that runs two symfony commands when invoked.
    cache_purge:
      name: 'cache:purge'
      description: 'Prune cache pools and application cache.'
      execute:
        # Run multiple commands 
        cache_pool:
          command: 'cache:pool:prune'
          symfony: true
        app_cache:
          command: 'cache:clear'
          symfony: true