将 Composer 添加为 Drupal 8 的管理器

Adding Composer as Manager of Drupal 8

我手动安装了 D8,但我需要 Composer 来管理和安装 Drush 和 Drupal 控制台。 我找到了有关全新安装的文档,但我想知道是否可以在手动安装 druapl 后将 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.

感谢提示。

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

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

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

但它用 alpha 版本替换了开发版本。 RC 承认,我更喜欢使用 dev 或 stable 而不是 alpha 或 beta。我该怎么做?

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

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

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

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

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

P.S。对于以后查看此答案的任何人,请检查 the core strategic initiative 以获取最新信息。