Package is not being installed

Created on 20 February 2025, about 2 months ago

The package Html2Text\Html2Text; is not being installed properly.
In the module brevo_mailer it require Html2Text\Html2Text;

    "require": {
        "getbrevo/brevo-php": "~2.0",
        "nyholm/psr7": "~1.2",
        "html2text/html2text": "^4.0.1"
    },

But when doing composer require 'drupal/brevo:^1.0' that dependency is not being installed, even after enabling the module brevo_mailer on Drupal.

When trying to send a test email you get the following error:

Error: Class "Html2Text\Html2Text" not found in Drupal\brevo_mailer\Plugin\Mail\BrevoMail->buildMessage() (line 257 of /var/www/webroot/webcms/releases/22-05-2023-143225/web/modules/contrib/brevo/modules/brevo_mailer/src/Plugin/Mail/BrevoMail.php).

Looking at the code unless I manually run composer require html2text/html2text:^4.0 the class is not properly loaded.
Is there an extra step required to install this plugin?

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain uridrupal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @uridrupal
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Hi uridrupal, I'm going to take a look at that, thanks for reporting the issue.

  • First commit to issue fork.
  • Merge request !3Add packages back to composer.json → (Open) created by kimberleycgm
  • 🇬🇧United Kingdom kimberleycgm

    I've opened a MR adding the packages back to composer.json. I believe, without using the composer merge plugins, all the required packages need to be included in the main composer.json because submodule versions aren't read and used when those submodules are enabled.

    The patch won't fix the problem while it's still a patch because patches are applied after the composer.json is read during composer install, so for now I've had to also require the packages directly in my project's composer.json.

  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Thanks kimberleycgm, I'll look into that! Anyone else can try the patch and comment if it's fixing their issues.
    We'll see for the best practises how to handle this.

  • 🇮🇹Italy antonio.bertolini

    For whom hasn't composer and use ludwig...
    ludwig.json:

    {
        "require": {
            "html2text/html2text": {
                "version": "v4.3.1",
                "url": "https://github.com/mtibben/html2text/archive/4.3.1.zip"
            },    
            "getbrevo/brevo-php": {
                "version": "v2.0.4",
                "url": "https://github.com/getbrevo/brevo-php/archive/refs/tags/v2.0.4.zip"
            },
             "nyholm/psr7": {
                "version": "1.8.2",
                "url": "https://github.com/Nyholm/psr7/archive/refs/tags/1.8.2.zip"
            }
        }
    }
    

    and add this row to brevo.module

    // Ludwig module integration.
    if (\Drupal::hasService('ludwig.require_once')) {
      $ludwig_require_once = \Drupal::service('ludwig.require_once');
      $ludwig_require_once->requireOnce('html2text/html2text', 'src/Html2Text.php', dirname(__FILE__));  
    }
    
    • renrhaf committed 69466b85 on 1.0.x
      Issue #3508000 by kimberleycgm, renrhaf: Package is not being installed
      
    • renrhaf committed ba22ebcd on 1.0.x
      Issue #3508000 by antonio.bertolini, renrhaf: Ludwig.json support
      
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Thanks for your participation, I reviewed the code and it's right, composer.json has to be in the main module only.
    Unfortunately everyone will have to install the dependencies needed for the mailer submodule even if unused.
    I also included the Ludwig.json support.

Production build 0.71.5 2024