Problem using Composer to install PHPMailer

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
JeffG1
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Feb 28, 2021 6:26 am

Sun Feb 28, 2021 7:14 am

I've downloaded and unzipped PHPMailer into its own folder, and installed Composer.

The installation instructions say "Just add this line to your composer.json file:

Code: Select all

"phpmailer/phpmailer": "^6.2"
In the unzipped package, there is a fully populated composer.json file in the PHPMailer folder which starts

Code: Select all

{
	"name": "phpmailer/phpmailer",
Ignoring the "add this line" instruction (because I can't see where to add it), if I open a command window and cd to the PHPMailer folder, then type "composer install" I get the following errors:

Code: Select all

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install
if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpmailer/phpmailer is present at version 1.0.0+no-version-set and cannot be modified by Composer
    - phpmailer/phpmailer 1.0.0+no-version-set conflicts with roave/security-advisories dev-latest.
    - Root composer.json requires roave/security-advisories dev-latest -> satisfiable by roave/security-advisories[dev-latest].
If as advised there, I use composer update instead of composer install, I get the following:

Code: Select all

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpmailer/phpmailer is present at version 1.0.0+no-version-set and cannot be modified by Composer
    - phpmailer/phpmailer 1.0.0+no-version-set conflicts with roave/security-advisories dev-latest.
    - Root composer.json requires roave/security-advisories dev-latest -> satisfiable by roave/security-advisories[dev-latest].
I don't know where to go from here. Please help!
JeffG1
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Feb 28, 2021 6:26 am

Sun Feb 28, 2021 8:48 am

OK - I think I have sorted this now, by installing from repository rather than downloading directly.
User avatar
Strider64
php-forum GURU
php-forum GURU
Posts: 419
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Sun Feb 28, 2021 11:34 am

Here's a good link to understand composer - https://phpenthusiast.com/blog/how-to-a ... h-composer
Life is a fig newton of your imagination! https://www.phototechguru.com/
User avatar
Strider64
php-forum GURU
php-forum GURU
Posts: 419
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Sun Feb 28, 2021 11:38 am

Here's an example of my composer.json file

Code: Select all

{
  "name": "vendor_name/mywebsite",
  "description": "description",
  "minimum-stability": "stable",
  "license": "proprietary",
  "authors": [
    {
      "name": "johndoe",
      "email": "johndoe@example.ocm"
    }
  ],
  "autoload": {
    "psr-4": {
      "Namespace_name\\":"src/"
    }
  },
  "require": {
    "swiftmailer/swiftmailer": "^6.0",
    "ext-pdo": "*",
    "ext-readline": "*",
    "ext-exif": "*",
    "ext-gd": "*",
    "ext-curl": "*"
  }
  ,
  "require-dev": {
    "roave/security-advisories": "dev-master"
  }
}
Life is a fig newton of your imagination! https://www.phototechguru.com/
Post Reply