Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ksavoie on
I have a manually installed D8 site (30+ modules) that I need to get into a structure/workflow where composer manages updates. 'Composer Manager' no longer functions thus my dependencies are currently broken.
I have scoured the net looking for a method to get existing sites under composer but have had no success getting it to work properly.
Does anyone have a tutorial they can point me to have pointers to share?
Looking for any guidance. Thanks.
Comments
It is in the documentation
It is in the documentation here. Because I could not remember the URL I used Google to find it: https://www.drupal.org/docs/develop/using-composer/using-composer-to-man...
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
I too am having great
I too am having great difficulty understanding this. Previously I was using Composer Manager. Now I am stuck with a live D8.2.4 site that needs a security update I am unable to achieve.
Unfortunately the page John_B links to, and all other pages I have found, seem intended for more experienced developers with an overview that I lack. I have used D6/7 and now 8 to run great little sites for local community groups. Drupal has been invaluable. I have always managed even writing some custom modules. However, this has me stumped. It would be disastrous for us to not be able to continue with Drupal just because of PHP dependencies. Some guidance for the less experienced would be very much appreciated indeed.
Using Composer Manager my PREVIOUS upgrade path (for this example assume a minor Drupal8 update and new version of Address module on Debian) was:
Please can someone explain in easy to understand steps how to do this without Composer Manager?
Thank you very much
Polly
I think the tar balls for
I think the tar balls for core still have the dependencies even the a few contrib modules do not. Am I wrong about that?
That sounds like hard work! Just ensure your server, or the machine where you run the update, has drush installed. Then log in, change directory to document root, and type
drush up
Hit 'enter'
and relax :)
I do it that way, though I don't have many D8 sites yet.
For more, search for updating Drupal with drush. Am I missing something here?
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
It seems straight forward so
Previously I was updating with a combination of Drush and Composer Manager. Didn't have an issue with it until my last round of updates as it looks like Composer Managers repo is no longer good.
This seems straight forward so I know I am missing something silly.
I have followed the directions and 'composer update' appears operable as it looks to update Drupal's dependencies, however module dependencies seem ignored. In fact on 'composer update' a dependency one of my modules requires is removed (one that 'Composer Manager' historically updated without issue).
Questions.
The instructions state to manually edit thee composer.json file with the following
Q1) Since the existing .json file already has a 'extra' section, do I append that, or create a new one (does it make a difference)?
Q2) My module,profile etc. paths do not match this format so I updated so they are the same. However I am not positive my path edits are accurate as it looks like a fresh Composer installed Drupal directory structure is quite different than what I am used to. My pathing is flat. At the root of the Drupal install, /modules, /profiles, etc... (no contrib/custom sub-directories). Are these the paths this section is referencing?
Any other insight appreciated!
Generally AFAIK (not very far
Generally AFAIK (not very far!) you should not have a duplicate key in composer.json file. Therefore the idea seems to be add these paths to the "extra" section.
If you are not using the contrib/ and custom/ subdirectories on you site, leave them out of the composer file.
Since the composer manager repo is no longer good, be sure also to update the repo by updating composer using the step here.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Hello John
Hello John
Thank you for your response. No, you are not the one missing anything - I have been stuck in my ways not using Drush. I am now trying to embrace it. Unfortunately I am having problems installing Drush. I will paste my Drush problems below hoping you might know the problem. If not I will resolve the Drush install problem and return here once I have tried your solution to my upgrade path.
I followed the 'Install a site-local Drush' here: http://docs.drush.org/en/master/install/
Hello John
Hello John
I installed Drush following the manual upgrade here: https://www.drupal.org/node/2603018.
Unfortunately I got an error on the drush up cmd. I am unable to find a solution. Do you have any suggestion?
The directory structure had changed. All the root files and core folder were now in 'html/drupal-8.2.7'.
It is a complete pain. Drupal
It is a complete pain. Drupal can be like that, and WordPress rarely is! Personally I would try removing drush then installing drush globally, as per the last two posts here.
Or install Drpual Console (drush alternative) and use command
drupal update:execute
Ultimately I regard having a working drush (and / or Drupal Console) install as the first step, because without that everything else is so difficult.
I do not really know your workflow. I think you said you are copying the site to a local computer for the update, then putting it back on the server. If so, perhaps use a local environment with a working drush and Drupal console already installed, such as a virtualbox set up using Drupal VM (drupalvm.com).
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Thank you John. I have
Thank you John. I have started down the road of following your suggestions but have run out of time right now. I will try again over the next few days and let you know how I get on.
For information: it appears
For information: it appears Drush should not be used if any commerce modules are used. See https://www.drupal.org/node/2865986
I've done it! I put this here
I've done it! I put this here in case this helps anyone else.
I had a D8.24 site created manually from tar with dependencies managed using Composer Manager. These are the steps I took to upgrade to D8.27 (now that Composer Manager is deprecated). I am not able to say if this is the best way bu it seems to have worked for me.
-Uninstall Composer Manager via Drupal interface (& delete folder)
-Delete all files and core folder in Drupal root (in my case '/var/www/html')
-Copy all files and core folder from 8.27 tar root into Drupal root (to replace deleted)
-In terminal go to Drupal root ('cd /var/www/html')
-In terminal run 'composer config repositories.drupal composer https://packages.drupal.org/8'
-In terminal run 'composer require drupal/name_of_library' for every contributed module & theme (eg 'composer require drupal/address', 'composer require drupal/ctools' etc)
-In terminal run 'composer update'
-Run /update.php via browser
well done :-)
well done :-)
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Thanks for your help John_B
Thanks for your help John_B
Just in case anyone needs
Just in case anyone needs this: ksavoie has a better way to do this. See his comment below: https://www.drupal.org/node/2863882#comment-12022504
When retrofitting a D8 site
When retrofitting a D8 site under Composer with several already installed modules, should composer automatically know these modules exist and pick them up for dependency updates? Or do I need to reinstall them via composer. I ask because this is where I am now stuck, Drupal dependencies are updated with a 'composer update' but module ones do not and are actually removed when the update is run.
Look at this from the same
Look at this from the same documentation page.
My understanding is that the first time after migrating you need to issue the command
composer require drupal/module_name
This will add the contributed module to the composer.json, and later updates should upate that module too. Alternatively you could have a half-way house, where you have not run the command
drupal-composer/drupal-project
in which case you will update those modules using your usual method, drush or whatever, which I would think would get complicated.
(For the sake of avoid confusion I assume you are using the composer drupal/drupal option and not drupal-composer/drupal-project option, also described on the documentation page, which places the composer.json above document root.)
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
I guess this is my question.
I guess this is my question. Their isn't a way for composer to review the currently installed modules and dynamically update the .json file with the appropriate required packages.
Basically I have to manually require every module for composer to pick them up.
That is my understanding,
That is my understanding, with the proviso that although I have used Composer I am not expert in it. My understanding is that either you issue the command >composer require and let composer write the composer.json file, or you manually add your requirements to composer.json.
Now it is fair to say that this process could be scripted, and that the drupal-composer project has a drush command (which I have not tried) which says it does automate that process according to the README.txt file on github. My inclination is that if the site is not huge it would be easier to it manually, at least until one has more experience and more confidence. If it is a lot of work owing to the size of the site, or if you have a lot of sites to move to composer, then it would start to make sense to look into automating the process.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
After working on this issue
After working on this issue for some time I have come to a solution that appears to work for me and is actually quite straight forward.
[ f.y.i. I make no warranties : ) ]
First I uninstalled/deleted the 'Composer Manager' module.
I replaced my composer.json file with the contents of the latest Drupal download. I then ran the following composer command to add in Drupal's composer repository to composer.json.
I manually added the paths to my directory structure to the 'extra' section of the composer.json file.
I manually added all my modules to the 'require' section of the composer.json file !carefully making sure the version numbering I indicated is what I wanted!. Note: correct version numbering can be a little confusing especially if you are using dev versions of modules.
e.g.
NOTE: In my case I removed
from composer.json and put ( "drupal/core": "^8.2", ) into the 'require' section.
This should complete the necessary adjustments to the composer.json. You should now be able to clear Composers cache 'composer clear-cache', and then update 'composer update' to get the files up to date.
After that you will need to make sure database updates are applied 'Drush updb'.
Once this is done you should be able to manage the site similarly to how you would any other.
Good Luck!
Thanks for putting this here.
Thanks for putting this here. I took a slightly different (and longer!) path (explained above) which I think got me to a similar place with one obvious difference. I wonder if it may be important. Perhaps you or someone else may comment.
installer-paths
I did not add this section to my composer.json. I think it means my dependency libraries are put in the root 'vendor' folder (rather than sub-folders within the named folders). Is that correct?
I now see that the documentation says "this doesn't jibe with Drupal modules, themes, profiles, and libraries" but I don't understand what this means.
What are the implications of not including the installer-paths section? My site seems to be working fine but do I need to correct this?
So I added the 'installer
So I added the 'installer-paths' section and moved the "drupal/core": "~8.2" line into require. I then ran 'composer update'.
It seems it downloaded D8.2.7 (which I was already on) but did nothing else. My root 'vendor' folder was not changed - it remained with the same number of items and MB size.
I don't understand. Perhaps now composer will change the location of dependencies when it next updates them?
Yeah, originally I was
Yeah, originally I was working a similar path to your 'longer' one but after I got my head around what was going on I believe this simpler method gets us to the same ending.
To be honest I am not positive that including installer paths is required if your respective directories are all at the root of your install. They may be required if you are using a alternate pathing or are using packaging with a git push/pull update workflow. Someone else may be able to clarify this.
If I get a second I may try excluding the installer paths in my .json on my DEV box and see what happens.
Are you still liking the method you posted?
@ksavoie
I've been looking for the same thing: how to convert a D8 site to composer-managed. Are you still liking the method you posted? Seems good to me, just checking as things change fast. ;-)
Also, I am unclear about how to tell whether or not a D8 site I got handed was setup to be composer-managed or not. Do you know the "best" way to determine that?
Thanks!
UPDATE:
Found answer to how to see if site is composer-managed: run drush up and you get a warning.
One other question - Is all
One other question - Is all this do-able on a localHost site? (retrofitting an existing D8 site to one managed by Drupal - done in a dev environment)
I have my first Drupal site (D8) in development, 90% done, and now need to retro-fit something that is *seemingly* mandatory. (I've updated my site successfully 2 or 3 times using cPanel's file manager)
Documentation aimed at non-programmers would be a blessing as people continue to evaluate Drupal 8 as a viable alternative to other CMS's.
Probably better do it locally
Probably better do it locally. In my experience 'composer require' won't work on shared hosting anyway (see blog post).
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
It would be local - then
It would be local - then uploaded to a VPS. Which seems do-able according to the blog. The problem now being - Does a finicky Composer (on a VPS) add a new layer of complexity to D8? (Further widening the unintended gulf of adoption by non-programmer types)
In your case, Composer would
In your case, Composer would/should not exist on your VPS. If you don't have CLI access it's moot anyway. It is exclusively used as a package management tool for the install and versioning of Core, Modules, and their respective dependencies. It is a tool used independent of Drupal. Drupal does not need it to operate. It took me a bit to get my head initially around the concepts. While you can use Composer commands to perform installs, for me I found it best to understand how to manually edit the composer.json format. It lets you have very good control over versioning.
If however you had ROOT/CLI access to your Production server and could install Composer, then their may be a case for running it their.
As for Drush, Drupal now recommends each Drupal site run their own install of Drush. Once you are set and running, Drush is relegated to usually only clearing cache and updating the DB once Composer has installed any new Core/Module updates.
Thanks for the feedback! Had
Thanks for the feedback! Had no idea Composer ran separately - I thought it was all tied in together.
I do not have the experience to even attempt the root/CLI access thing. So that is great to know.
While I had/have no intention of "hijacking" this thread (apologize if that is the way it seems) - this is all really important information that non-programmer types need to know.
For clarification:
1 - Install Composer on local computer
2 - Install Drush on local computer
3 - Pull site down from off-site production server to local dev environment
Drush - similar to shell access - can reach anywhere including my off-site production server
Composer - stays local to do updates - the resultant updated site gets put back on production server
Question 1: Is this correct thought process?
Question 2: Are Drush and Composer two roads to the same destination?
Thanks!
Drush can download and
Drush can download and install a site as well as doing many other things. Compser is only for installing and updating software. Drupal Console is a competitor to Drush for Drupal 8 only. Drupal Console removed the install and update features because it was though better to leave that to Composer. AFAIK these things are still possible with Drush but not recommended. To be more precise, installing and updating other than with Composer is not the recommended method for and by people who mainly work in teams on large 'enterprise' sites.
Although I have read about a Composer graphical interface, these are all command line tools.
For a small site, and for shared hosting, I think the question of whether Composer solves more problems that it causes is still open. Personally I am not persuaded that it is anything like 'compulsory.' I have not recently tried installing Drupal 8 without it, so not sure.
There are many things which are easier on command line, and it is always worth learning a few drush commands when working with Drupal. To a great extent the things Drupal Console can do overlaps with what drush can do.
I should add that many shared hosts and VPS providers will provide command line / shell access, even on services where they will ot provide root access. Sometimes you have ask for it.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
"I have not recently tried
"I have not recently tried installing Drupal 8 without it, so not sure."
I started a D8 project in November and have since upgraded it twice without any mention of composer. If I could existed without it - I would. But at some point it seems like it will be mandatory?
I doubt it will be mandatory.
I doubt it will be mandatory. But contributed modules which sometimes use Composer to install dependencies will be more complex to install without it. Same with updates.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Mandatory for an initial
Mandatory for an initial install of Core, as of now no. However there are modules (Search API) where Composer is required (they don't work) due to dependencies. My site has 15+ modules and probably 4-5 have dependencies. For today's Drupal, Composer is pretty much necessary. Trust me, once you have your DEV environment set up and running with Composer maintenance is quite painless. Just the initial hump :).
As for Drush, historically Drush was standalone and did much of what Composer does now. But with D8s new framework (Symphony), it's dependencies, and an existing tool (Composer) already designed specifically to manage such an environment, it makes sense that most of Drush's functions have been depreciated. Composer can manage code but doesn't know/touch specifics about Drupal. That is where Drush still finds it's purpose, to manage DB schema/data updates and manually clearing caches plus a few other non-critical functions.
Yes you can spin up a site without it, but you'll eventually find it difficult to maintain once you get into much complexity. Not hard retrofitting Composer into an existing install but if you follow the instructions to get a base site initiated/installed via Composer you will bypass the few issues involved in backtracking.
Once set up, only 2 commands to update a D8 site with composer (if Drush is installed in the site).
I might add that if you are
I might add that if you are reluctant about Composer (which I can understand), and not yet used to working on command line (which I highly recommend learning gradually), chances are that Drupal 8 is not the best tool for the site. Backdrop, for all its limitations, is a fork of Drupal 7 which has Views in core as far as I know, and could be a good option for situations where WordPress or Concrete 5 or whatever does not cut it.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
And I'll add to John_B's
And I'll add to John_B's thought : ), I work and have worked in several Open Source and Commercial CMSs. Drupal (especially D8) is a very solid/secure platform. However it is not completely the GUI plug-n-play development/maintenance platform that are offered by its competitors. You need to do work outside of the GUI and simple FTPing of files and understand a few technicalities in order to fully maximize what it can and should do to minimize the headaches/frustration that occur for not understanding such. I hate to say it but for all that is awesome about Drupal, D8 widened the cost of entry for Jr. developers.
Hah... that bridge has been
Hah... that bridge has been crossed! I understand what you are saying. I see a lot of cool things in Drupal, and thought D8 was more mature than it was. It's sort of like the wild west though - lots of promise, with lots of hidden danger! :^)
@ksavoie - agree with the cost of entry - wholeheartedly.
Maturity is not the correct
Maturity is not the correct analogy. It's more of a difference in mentality and target of the platform. Drupal is quite mature and in fact more mature technically than many. The D8 rewrite into its new framework was a crazy undertaking that formalized and straightened out a whole slew of development issues that plagued it's predecessor and are present in other platforms. Symphony offers a solid base to build upon. I understand a developers hesitation and initial feeling of irritability in working with Drupal as I had the same but don't get caught up in "you can't do it in the GUI so it must be bad" mindset. Yes there are things that take longer to develop than other platforms. But as you get to know the system better you will start having moments of understanding of the amazing inherent flexibility that allows you to get complex pieces to work and look exactly how you want without relying on a module or plugin (if it exist). It's not for everyone and definitely not for every project but as you work with it you will start being able to determine which projects are a great fit for it.
By "mature" I meant (re: D8)
By "mature" I meant (re: D8) 'all the kinks ironed out to a much larger degree'. There is no doubt about the maturity of the platform as a whole. Honestly - as I've dealt with Wordpress and Joomla - it's always been "those guys over there" that develop it. From a non-programmers standpoint, with Drupal and the Drupal community - it's really pretty intimidating when "those guys over there" are literally all around you! I've gotten this far - not stopping now!
It's not for everyone and definitely not for every project but as you work with it you will start being able to determine which projects are a great fit for it.
Once I understood Exposed Filters - I added a whole new section to this website in development that wasn't even on the chalkboard for the web site. Basically a parts catalog that can narrow a list down based on check-boxes (Material, Machine, etc).
But then multiple exposed filters did not work (and don't know if it's fixed yet in the latest D8 version) - I soon figured out I can add an additional taxonomy as a work-around.
Anyway - Next task is figuring out Composer!
Composer security concerns
I'm also sorry to hijack this thread, but it's the most useful one I've found so far.
First I would like to thank all of you for showing me how to change mid-stream from using drush to using composer in order manage contrib and core updates. There is nowhere else I've found that documents this (least of all Using Composer to manage Drupal site dependencies, which of all places you would think would actually document this).
I'm confused about the yes/no dilemma about using Composer in production. Do you really need composer in production? makes a really good point. The use cases this author points out are really similar to ours. After all, a Drupal website is a "living thing" indeed, and "deployment" and "distribution" are not the same thing at all.
The other issue is security. I would rather not run
composer update
on the production server, because then my production workflow would be to log in as root and temporarily turn onallow_url_fopen
andproc_open
before doing mycomposer update
command (and then remembering to turn them back off).So what does this mean? I think it means that my old workflow, of committing only the
modules
andtheme
directories to our git repo, has to be augmented by also committing all of thecore
andvendor
directories as well, since switching from the old "delete the core and vendor directories and copy the new ones from the tarball" way of upgrading core is deprecated, and I'm now supposed to only use Composer to manage core updates.This is a little weird and depressing, because in the old Drupal 7, pre-Composer world, our git repo was never bloated with all the core stuff. However, security is very important, and I'm extremely unwilling to compromise the hardening we've done in our php.ini file.
Which is better? Editing the
php.ini
every time, or committing thevendor
andcore
directories to my repo?The prevailing Drupal attitude toward
allow_url_fopen
andproc_open
seems to be just laughing off the concerns, but having friends who work in cybersecurity, I have completely the opposite attitude.PS - diff between composer update and composer install
https://adamcod.es/2013/03/07/composer-install-vs-composer-update.html
PS -- the above seems to indicate that if you do decide to use composer on your production server, you should only add your
composer.lock
and not yourcomposer.json
to your git repo, and then pull that and do acomposer install
rather than acomposer update
. Is this really true? Any additional pointers would be appreciated.While for a production deploy
While for a production deploy one would only really need the composer.lock since this file contains the exact versions (in other words on what it is locked on) however the composer.json has a less restricted versioning and follows patterns like higher then (>) version 1.0 or lower then (<) 2.3 for example. Which is useful for the development fase where exact versions are not that important but backwards-incompatibility changes can still be avoided. For this composer strictly handles a versioning protocol called semver (see http://semver.org). This versioning protocol works with a 3 number notation, MAJOR.MINOR.PATCH. To answer your question, YES, always commited both composer.lock and composer.json. Composer install only installs the exact versions from the composer.lock if present, if not present it will do the same as composer update and update everything to the latest version allowed by the composer.json restrictions.
what a mess
I've spent two days trying to wrap my head around drush, composer, and just the sheer amount of "oh but you also have to do this, didn't you know?".
At this point I think I may just stop at Drupal 8.3 and hope I don't get hacked. Then get back into the game when a WYSIWYG option appears (if ever..) that works on shared hosting (unlikely).
It feels like all empathy has drained form Drupal. I always considered "you can do it through WYSIWYG" to be a core pilar of what the Drupal community believed in. It's what got me involved. The easy with which that pillar has been removed is astounding.
I hear you
You said "I may just stop at Drupal 8.3". Does that mean you have a Drupal 8.3 site that you are trying to update to 8.4? If so I might be able to post something to help, but would need to know: what exact version are you on now (what is "x"): 8.3.x ? Did you originally install it with composer, drush, or just download it as a tarball (like "the old days")? And do you have a web folder that index.php is located in, or is index.php in the same folder as the core folder (e.g. there is no /web folder)?
Curious what this means: "a WYSIWYG option appears (if ever..) that works on shared hosting". Is your 8.3 WYSIWYG not working? At any rate, this is not the case IMHO: "I always considered 'you can do it through WYSIWYG' to be a core pillar of what the Drupal community believed in." Quite the opposite actually. One should separate content into separate fields, not put everything into a WYSIWYG.
IMHO Drupal 8 is by far the best version of Drupal ever, mainly because of the build on top of symfony and using twig. BUT it has definitely become more challenging for developers to use in some areas (composer being one of them). Drupal is probably not be the right tool for simple sites anymore. I work with Drupal all day long, and love it, but have moved simple Drupal sites I did for my freelance clients to Squarespace. Honestly if your site(s) is simple, I would move to that, particularly because you don't have to worry about updates. Drupal has move more toward "enterprise" while SAS options like Squarespace and Wix have become better for simple sites.
PS: very good articles about composer here:
February 13, 2017
Tips for Managing Drupal 8 projects with Composer
https://www.jeffgeerling.com/blog/2017/tips-managing-drupal-8-projects-c...
May 3, 2017
Composer and Drupal are still strange bedfellows
https://www.jeffgeerling.com/blog/2017/composer-and-drupal-are-still-str...
This is also very good:
Using Composer to manage Drupal site dependencies
https://www.drupal.org/docs/develop/using-composer/using-composer-to-man...
It should have been called drupal 9
I suspect Drupal 8.4 should have been called Drupal 9, simply because there is no easy upgrade path.
The site in question is an 8.1 distribution that has been upgraded to 8.3.5 over time. It was not built with Composer or Drush, but with Dev Desktop.
I tried..
- Upgrading via file overwrite. No, doesn't work anymore. Ok then..
- Upgrading via Drush in DevDesktop.. ah but then it won't work anymore once the site is 8.4.
- Loads of warnings, do they matter? bootstrap.inc not found for modules I haven't even heard of (LINT or something), and can't find in my code.
- Upgrading via Drush (need Drush 8.1.12/8.1.15.. ok. There's also Drush 9, but that won't work for 8.3.5 sites (which I have more of).
- Instlaling drush 8.1.15 needed a lot of research: how do you do that? There is surprisingly little guidance online. Only for Drush 9.
- Drush 8.1.15 upgraded.. gives other errors.
- Drush gives errors if the drush is in the code you are trying to upgrade. The error being that the entire site is deleted.. great, start again.
- Try to switch the DevDesktop version of Drush manually. Is this ok? No idea. Getting a backup error.
- Composer then.. installing that was hard until I finally discovered Drush has a command for that. But do you install it locally or globally? What does that mean exactly, and where are things stored? How does it interact with other local sites?
- Memory is too small for composer.. start again.. ok.
- Require? Override? You need to change this for it to maybe work.. can I do that by hand?
- Drush up, Drush up drupal, composer update, composer etc --with dependencies.. what are the differences exactly?
- Ah so it matters what directory things are in. Ideally, put the site in a sub directory.
- Ah, so I can't composer upgrade a site that wasn't built with composer.. right.
- There's a Drush option to 'discover' all the modules, but it's not recommended. And would it work with the rather complex distribution anyway?
- Maybe I can make a new site and move things over via the new settings configuration files that I had such high hopes for. Nope. If you want to copy the entire site over, then the UUID is put into every file. Why? Who knows.
- Ah, there are three ways of starting a new Drupal 8 site via composer. But which framework is best? Sparse documentation that as ever implies you already feel totally comfortable around the commandline and understand all the implied things about directory structures. If I use a framework with a sub directory, will that mean that my site will now live at bla.com/web ? Who knows.
Etc etc, forgetting loads.
These are not questions I'm looking for answers to, I just wanted to give an indication of the complexity that is the "simply commandline option" that is being forced on everyone.
It works OK if you build the
It works OK if you build the site with composer. Use option A on https://www.drupal.org/node/2718229 drupal-composer/drupal-project , it is the most widely accepted and I guess it may become official. Run composer update from project directory which with that method is one level above document root. Then use drush (or Drupal console if you prefer) to run drush updb to update the database.
Be careful with composer update unless the site is under version control: unlike drush up, there is no backup of code made before the new code is copied in.
True, it will be a pain if the site was not built with composer.
Dries told Vienna DrupalCon that he is personally offended when it is said Drupal has abandoned small users (without seriously arguing it was untrue, as far as I could hear), so I will not repeat the allegation. Other tools for other times...
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
How to port from drush -> composer
If you're here looking for a way to migrate your modules from drush to composer without having to manually require every single module, try this from your drupal install directory, AND FOR THE LOVE OF ALL THAT IS HOLY, BACK UP YOUR CODE AND DATABASE FIRST:
ls -1 modules/contrib/ | xargs -L 1 -I {} composer require drupal/{}
If you have a lot of modules, it will take a while to run.
Also like stated in https:/
Also like stated in https://www.drupal.org/docs/develop/using-composer/using-composer-to-man... it is also an option to use module or composer project to help create a composer.json file. Both of these have saved me quite some time.
Might be nice to have a drush ( or drupal) command for this also though.
Migrating a Drupal 8 site
Migrating a Drupal 8 site into a Composer-managed build
https://docs.acquia.com/resource/composer/d8-migrate/
Drupal development, maintenance and support in Bulgaria, EU, UK, USA and UAE.
Convert existing D8 site to composer managed (using git)
I wrote a tutorial that I think will be beneficial to this thread:
https://shivanjaikaran.com/drupal-8-composerizing-drupal-8-10-easy-steps