Skip to main content
8 events
when toggle format what by license comment
Jan 24, 2019 at 14:43 vote accept Jake Stewart
Jan 9, 2019 at 14:31 comment added Jake Stewart The namespace that I'm using is the only one that PHPStorm suggests.
Jan 9, 2019 at 14:13 comment added Kevin External packages have their own namespaces, using Drupal on them won’t work. I suggest using an IDE like PHPStorm, it will reduce the guessing on namespaces and paths and dependency injection.
Jan 9, 2019 at 7:13 answer added taggartJ timeline score: 0
Jan 9, 2019 at 7:02 comment added taggartJ sooo ... composer require phpmailer/phpmailer installs the package in the root vendor folder like @keven ^^ says should just be "use PHPMailer\PHPMailer\PHPMailer" if not perhas "use phpmailer\PHPMailer\PHPMailer" ??!
Jan 9, 2019 at 5:53 comment added Jake Stewart Thanks @Kevin, I initially installed the package into the module's directory but found that the only time my code would work is if I used a Drupal namespace. So... I added it to the root vendor folder and tried the dependency injection approach but still nothing. What is proper protocol when using a package in a Drupal module?
Jan 9, 2019 at 5:20 comment added Kevin Are those the right paths for the use statement? Also, strive to use dependency injection for your classes (no new statement or global container). require should never be needed in 99% of cases. How did you install the package? It states that it’s in the modules vendor folder, but it should really be in the root vendor folder.
Jan 9, 2019 at 4:51 history asked Jake Stewart CC BY-SA 4.0