0

I installed D8 manually but I need Composer to Manage and Install Drush and Drupal Console. I found docs about fresh install, but I would to know if it's possible to add Composer as Drupal components manager after a manual druapl install ?

Actually I have Composer and Drush9 installed. But I can't do update for D8 because Composer doesn't find infos about this:

 ~/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.

Thanks for tips.

EDIT: is this a good and actual way ? tuto

EDIT2: as I must update modules too, I face off a little issue ragarding "minimum-stability" , I put this in my composer.json,

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

But it replace dev version by alpha ones. I prefer using dev or stable not alpha or beta, RC admitted. How can I do that ?

EDIT3: modules aren't downloaded in modules/contrib, so do I need to add this to my composer.json ?

"extra": {
        "installer-paths": {
            "modules/contrib/{$name}/": ["type:drupal-module"],
            "themes/contrib/{$name}/": ["type:drupal-theme"]
        },
webmaster pf
  • 389
  • 1
  • 5
  • 23

1 Answers1

1

You can definitely attempt the recommendations on the guide you linked to. Take a full code, database, and file backup of the site first.

That said, I highly recommend you re-build the site using drupal-project. After which:

  • run composer require for all of your contributed modules / themes
  • copy any custom modules / themes
  • re-import the database
  • copy over your files directory

P.S. to anyone viewing this answer in the future please check the core strategic initiative for up to date info.

Isaiah Nixon
  • 320
  • 1
  • 10
  • Yes I found this too : https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#composer-from-scratch and I prefer to choose where to put drupal files,so it could be a good way too ? Do in both cases, I install Drush and Drupal Console ? – webmaster pf Sep 11 '19 at 07:18
  • I'm modifying a first website, and I don't see infos about "installer-paths": in my composer.json.. is it normal ? – webmaster pf Sep 11 '19 at 10:35
  • do I need to just update drupal when necessary or I must update other parts (like symfony) separatly ? All works fine. – webmaster pf Sep 11 '19 at 12:29
  • 1
    **1)** You can install Drush and Drupal Console using composer. In fact, I recommend it. **2)** "installer-paths" should be set up if you use drupal-project. Please see [composer.json](https://github.com/drupal-composer/drupal-project/blob/8.x/composer.json) **3)** You can absolutely update parts of symfony without updating core. However, the recommended way is to update core and its dependencies at once using `composer update drupal/core webflo/drupal-core-require-dev --with-dependencies`. Please see [Update core via Composer](https://www.drupal.org/docs/8/update/update-core-via-composer) – Isaiah Nixon Sep 11 '19 at 15:35
  • Another detail: how can I set the minimum stability to use dev or stable version ? see edit – webmaster pf Sep 12 '19 at 08:24
  • That seems like a separate question. Somebody may have some good insight into that. However, I have always followed the default composer `prefer-stable` behavior. – Isaiah Nixon Sep 12 '19 at 17:26
  • it's furhther question more :) .I'm near to have a functionnal composer system . So don't you use "minimum-stability": setting ? // With my extra settings, modules are in the right folder.Fixed part – webmaster pf Sep 13 '19 at 07:00