essgeebee/console-command-service-provider

一个用于Cache、Doctrine DBAL和Assetic常见控制台命令的Silex服务提供商

dev-master 2014-04-07 22:04 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:34:35 UTC


README

一个用于Cache、Doctrine DBAL和Assetic常见控制台命令的Silex服务提供商

##安装

将依赖项添加到您的composer.json中

"essgeebee/console-command-service-provider"    : "dev-master"

###安装skeleton app/console和src/console.php文件

注意,这些文件假设特定的项目结构 - 有关更多详细信息,请参阅templates/console文件

添加到您的composer.json中

"autoload": {
        "psr-0": { 
          ...
          "Ten24": "vendor/essgeebee/console-command-service-provider/src/" 
        }
    },
...    
"scripts": {
        "post-install-cmd": [ 
            "Ten24\\Composer\\ConsoleCommandInstaller::postInstallCmd"
        ],
        "post-update-cmd": [ 
            "Ten24\\Composer\\ConsoleCommandInstaller::postUpdateCmd"
        ]
    }

运行

composer run-script post-update-cmd

composer run-script post-install-cmd

这将尝试在项目根目录中创建目录'app'和'src'(如果不存在),并将模板文件'console'和'templates/console.php'分别复制到'app/'和'src/'中。

从您的终端,您现在应该可以运行

app/console

并得到类似以下的结果

MyProject version 0.1

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  help                       Displays help for a command
  list                       Lists commands
assetic
  assetic:dump               Dumps all assets to the filesystem
cache
  cache:clear                Clears the cache
doctrine
  doctrine:database:create   Creates the configured databases
  doctrine:database:drop     Drops the configured databases
  doctrine:schema:load       Load schema
  doctrine:schema:show       Output schema declaration

##默认注册的命令默认情况下,以下命令已注册到控制台

  • doctrine:schema:show
  • doctrine:schema:load
  • doctrine:database:create
  • doctrine:database:drop
  • cache:clear
  • assetic:dump

##配置选项

Provider在$app['ten24.consolecommand.options']中寻找其选项。以下是可用的选项列表 - 所有键都在$app['ten24.consolecommand.options']中。请注意,必需的选项确实有默认值,这些值可能与您的项目结构不匹配。

  • doctrine
    • schemaFile(必需,默认:$app['root.dir']./app/config/database/schema.php)
    • registerSchemaShow(可选,默认:true)
    • registerSchemaLoad(可选,默认:true)
    • registerDatabaseDrop(可选,默认:true)
    • registerDatabaseCreate(可选,默认:true)
  • cache
    • cachePath(必需,默认:$app['root.dir']./app/cache)
    • registerClear(可选,默认:true)
  • assetic
    • registerDump(可选,默认:true)