Problem using Composer to install PHPMailer

A

Anonymous

Guest
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:
"phpmailer/phpmailer": "^6.2"

In the unzipped package, there is a fully populated composer.json file in the PHPMailer folder which starts
Code:
{
	"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:
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:
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!
 
OK - I think I have sorted this now, by installing from repository rather than downloading directly.
 
Here's an example of my composer.json file

Code:
{
  "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"
  }
}
 
Back
Top