一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Drupal 8 开发工具 Drupal Console 介绍

时间:2015-06-07 编辑:简简单单 来源:一聚教程网

相信众多开发者已经开始drupal8的探索――下载、安装drupal 8的beta版本进行尝试。对于那些没有开始尝试drupal 8的开发者们,作者可以很明确的告诉大家,我们将会有众多新概念去了解、理解、使用。当我们尝试写一个drupal 8模块的时候,我们也需要知道大量的代码知识。这也给我们造成了新的挑战,那就是层出不穷的报错。

幸好,新的drupal 8开发工具已经诞生并投入广泛的测试与使用中。

它就是drupalconsole,我们今天的主角。

相比于之前的drush,drupalconsole在作者看来更为有趣。它起源于symfony,一款非常棒的php框架――如果你有兴趣去了解它的话。它服务于drupal 8的开发过程。
那么,Drupal Console是什么呢?

    The Drupal Console is an effort to bring The Symfony Console Component to Drupal 8.

该项目的目的是发挥symfony console组件的影响力到drupal 8的世界中。它可以帮助你创建drupal 8 模块。

该项目可以使你将精力集中到一件事情上去――创造命令。

项目信息在哪?

    项目主页 http://drupalconsole.com
    Drupal官网 https://drupal.org/project/console
    Github https://github.com/hechoendrupal/DrupalAppConsole
    文档 http://hechoendrupal.gitbooks.io/drupal-console
    在线支持 https://gitter.im/hechoendrupal/DrupalAppConsole

上手操作

安装:
curl -LSs http://drupalconsole.com/installer | php
如果没有curl的话
php -r "readfile('http://drupalconsole.com/installer');" | php
上面的命令会检查服务器php.ini设置,如果没能够达到要求,可以自行百度修改设置。

然后:
mv console.phar /usr/local/bin/drupal

进入drupal 8的安装目录,你就可以执行下面的命令啦!
drupal generate:module


附drupalconsole官网的一张动态图片,右键新窗口打开,更好的体验drupalconsole带来的乐趣。

drupalconsole
附DrupalConsole命令:可以在drupalconsole命令行中输入“drupal”即可调出所有命令。

Usage:
 command [options] [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
 --drupal (-d)         Path to Drupal root.
 --shell (-s)          Launch the shell.
 --env (-e)            The Environment name. (default: "prod")
 --no-debug            Switches off debug mode.
 --learning            Generate a verbose code output.

Available commands:
 cr                                 Rebuild and clear all site caches.
 drush                              Run drush from console.
 help                               Displays help for a command
 list                               Lists commands
 self-update                        Update the console to latest version.
cache
 cache:rebuild                      Rebuild and clear all site caches.
config
 config:debug                       Show the current configuration.
 config:edit                        Edit the selected configuration.
 config:export                      Export current application configuration.
 config:override                    Override config value in active configuration.
container
 container:debug                    Displays current services for an application.
generate
 generate:authentication:provider   Generate an Authentication Provider
 generate:command                   Generate commands for the console.
 generate:controller                Generate & Register a controller
 generate:entity:config             Generate a new "EntityConfig"
 generate:entity:content            Generate a new "EntityContent"
 generate:form:config               Generate a new "ConfigFormBase"
 generate:module                    Generate a module.
 generate:permissions               Generate module permissions
 generate:plugin:block              Generate a plugin block
 generate:plugin:imageeffect        Generate image effect plugin.
 generate:plugin:rest:resource      Generate plugin rest resource
 generate:plugin:rulesaction        Generate a plugin rule action
 generate:service                   Generate service
migrate
 migrate:debug                      Display current migration available for the application
 migrate:execute                    Execute a migration available for application
module
 module:debug                       Display current modules available for application
 module:download                    Install module or modules in the application
 module:install                     Install module or modules in the application
 module:uninstall                   Install module or modules in the application
rest
 rest:debug                         Display current rest resource for the application
 rest:disable                       Disable a rest resource for the application
 rest:enable                        Enable a rest resource for the application
router
 router:debug                       Displays current routes for the application
 router:rebuild                     Rebuild routes for the application
site
 site:maintenance                   Switch site into maintenance mode
 site:mode                          Switch system performance configuration
test
 test:debug                         List Test Units available for the application.

热门栏目