0

I'm working on a custom module and want to use phpoffice/phpexcel

I can install the library just fine with composer require phpoffice/phpexcel, but what if I update Drupal-Core to a new version and by doing so override the composer.json? I would have to remember to do another composer require ... to add the dependency again.

What is the right way of doing this? I have a similar problem with the address-Module, which also requires to be installed with composer.

0

To avoid overriding composer.json file you should update drupal/core using composer too.

https://www.drupal.org/docs/8/update/update-procedure-in-drupal-8

To update only drupal/core you will have something like

composer update drupal/core --with-dependencies

Which will only update the composer.json file, not overriding it.

[EDIT] Before you begin ( from documentation )

  1. Always take a backup of your files and db before updating.
  2. If you're using composer and version control, also commit and push composer.json and composer.lock. Use mysqldump to backup your database. Modules such as Backup and Migrate are also available.
  3. Alternatively, you can create a .tar.gz of files and the database with drush archive-dump (however this is a legacy command, slated for removal in Drush 9, which only covers files under /web).
  4. Read the core release notes and, as a precaution, check the project page for each contributed module, theme or plugin: some may need updating to work with a new "minor" version (e.g. 8.3) of core. Patch releases (e.g. 8.3.1) shouldn't require this, but it's advisable to test in a development environment first.
  5. Activate maintenance mode when updating production servers.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.