There is no absolute standard mechamism for installing Composer dependencies in D7. But regardless whichever standard is used:
- It would install the full phpmailer/phpmailer package in a 'vendor' directory. (Esp. given the composer.json is not specifying anything else.)
- The phpmailer module uses libraries_get_path() for loading (just 2 classes from) the package, which cannot use the 'vendor' location; it only reads from a couple of hardcoded locations.
- Because of the (correct) hook_requirements, you cannot even enable phpmailer until you copied the classes in the right place, regardless whether the package is already installed by composer.
This means the composer.json is useless in the D7 version, and only leads to installing a duplicate version of the phpmailer/phpmailer library.
The 'de facto standard' for using composer libraries in D7 is the composer_manager module. This module will keep trying to install the duplicate/unused library in the vendor directory, and (because of the presence of the composer.json) its administration screen will keep complaining about a missing uninstalled library, until you do so.
Since I don't like having duplicate unused code on my system: here's a patch to delete the composer.json. I'm sure it's harmless for existing systems, because of the above reasoning. (Systems using Composer Manager which update to the phpmailer module without the composer.json present, will likely be prompted that they can uninstall the phpmailer/phpmailer package. Which is a good thing.)
I have no idea what caused #1980288: Add composer.json to be filed, nearly 7 years ago. I would ask PatchRanger but he apparently hasn't posted on drupal.org (and his own website hasn't been updated) for 5-6 years.
| Comment | File | Size | Author |
|---|---|---|---|
| phpmailer-remove-composer-json.patch | 730 bytes | roderik |
Comments
Comment #2
astonvictor commentedD7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.