首页 > 解决方案 > 将 Composer 添加为 Drupal 8 的管理器

问题描述

我手动安装了 D8,但我需要 Composer 来管理和安装 Drush 和 Drupal 控制台。我找到了有关全新安装的文档,但我想知道是否可以在手动安装 drupal 后将 Composer 添加为 Drupal 组件管理器?

实际上我已经安装了 Composer 和 Drush9。但是我不能为 D8 做更新,因为 Composer 没有找到关于这个的信息:

 ~/www/mgasquet/sited8 $ composer outdated
behat/mink-selenium2-driver          dev-master 93474c6 dev-master 3ab9f31 Selenium2 (WebDriver) driver for Mink framework
brumann/polyfill-unserialize         v1.0.3             v1.0.4             Backports unserialize options introduced in PHP 7.0 to older PHP versions.
composer/installers                  v1.6.0             v1.7.0             A multi-framework Composer library installer
dflydev/dot-access-data              v1.1.0             v2.0.0             Given a deep data structure, access data by dot notation.
doctrine/annotations                 v1.2.7             v1.7.0             Docblock Annotations Parser
doctrine/cache                       v1.6.2             v1.8.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.3.0             v1.6.2             Collections Abstraction library
doctrine/common                      v2.6.2             v2.10.0            Common Library for Doctrine projects
doctrine/inflector                   v1.1.0             v1.3.0             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.0.5              1.2.0              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       v1.0.1             1.1.0              Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
drupal/coder                         8.3.1              8.3.6              Coder is a library to review Drupal code.
egulias/email-validator              2.1.7              2.1.11             A library for validating emails against several RFCs
grasmash/yaml-expander               1.4.0              2.0.0              Expands internal property references in a yaml file.

感谢您的提示。

编辑:这是一个好的和实际的方法吗?都托

EDIT2:因为我也必须更新模块,所以我遇到了一个小问题"minimum-stability",我把它放在我的 composer.json 中,

"minimum-stability": "dev",
    "prefer-stable": true,

但它用 alpha 版本替换了开发版本。RC 承认,我更喜欢使用 dev 或 stable 而不是 alpha 或 beta。我怎样才能做到这一点 ?

EDIT3:模块未在模块/contrib 中下载,所以我需要将其添加到我的 composer.json 吗?

"extra": {
        "installer-paths": {
            "modules/contrib/{$name}/": ["type:drupal-module"],
            "themes/contrib/{$name}/": ["type:drupal-theme"]
        },

标签: composer-phpdrupal-8drupal-console

解决方案


您绝对可以尝试链接到的指南中的建议。首先对站点进行完整的代码、数据库和文件备份。

也就是说,我强烈建议您使用drupal-project重新构建站点。之后:

  • composer require为您贡献的所有模块/主题运行
  • 复制任何自定义模块/主题
  • 重新导入数据库
  • 复制您的文件目录

PS 对于将来查看此答案的任何人,请查看核心战略计划以获取最新信息。


推荐阅读