Question

I have been trying to install mailgun library in my localhost using composer. I wrote in the command prompt the following commands:

php composer require mailgun/mailgun-php:~1.3

it gives me error as Could not open input file: composer

then I tried removing the php at the beginning of the previous command :

composer require mailgun/mailgun-php:~1.3

it shows:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package mailgun/mailgun-php 1.0.0 could not be found.
Problem 2
- guzzle/guzzle v3.7.4 requires ext-curl * -> the requested PHP extension cu
rl is missing from your system.
- guzzle/guzzle v3.7.3 requires ext-curl * -> the requested PHP extension cu
rl is missing from your system.
- guzzle/guzzle v3.7.2 requires ext-curl * -> the requested PHP extension cu
rl is missing from your system.
- guzzle/guzzle v3.7.1 requires ext-curl * -> the requested PHP extension cu
rl is missing from your system.
- guzzle/guzzle v3.7.0 requires ext-curl * -> the requested PHP extension cu
rl is missing from your system.
- Installation request for guzzle/guzzle 3.7.* -> satisfiable by guzzle/guzz
le[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].

Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
 see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
problems.

Installation failed, reverting ./composer.json to its original content.

I have been struggling to install mailgun for couple of days, please help me.

Update:

FYI: I am using windows using xampp

composer.phar file details:

{
"name": "mailgun/mailgun-php",
"description": "The Mailgun SDK provides methods for all API functions.",
"require": {
    "guzzle/guzzle": "3.7.*"
},
"require-dev": {
    "phpunit/phpunit": "3.7.*"
},
"autoload": {
    "psr-0": {
        "Mailgun\\Tests": "tests/",
        "Mailgun": "src/"
    }
},
"license": "MIT",
"authors": [
    {
        "name": "Travis Swientek",
        "email": "travis@mailgunhq.com"
    }
],
"minimum-stability": "stable"
}
Was it helpful?

Solution

mailgun uses guzzle which needs php>=5.3.3 and curl extension

Do the following:

  • update composer: composer self-update
  • check php version: php -v
  • install curl extension: [sudo] apt-get install php5-curl

And if you use windows then try these:

If you still get an error with composer require ...

  • If exists, remove "composer.lock" file from you project's root directory.
  • Create a "composer.json" file on your project's root directory as below.
  • Run composer install

// composer.json:

{
    "require": {
        "mailgun/mailgun-php": "~1.5"
    }
}

OTHER TIPS

composer require mailgun/mailgun-php:~1.7.1

Worked for me - Windows, XAMPP.

Find your php.ini and uncomment extension=php_curl.dll.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top