1

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"
}
Steve Tauber
  • 9,551
  • 5
  • 42
  • 46
StreetCoder
  • 9,871
  • 9
  • 44
  • 62
  • please show me your current composer.json – Ilan Frumer Jan 06 '14 at 12:56
  • I have update my question with composer.phar file. ( I replied on your answer lately due to the reason unfortunately first time I did not get any notification over stackoverflow activity ) – StreetCoder Jan 07 '14 at 05:23
  • Please show me your project's composer.json , not the composer.json file of the mailgun library – Ilan Frumer Jan 07 '14 at 09:13
  • Actually, I did not create any project for my own yet. I have downloaded mailgun library and been trying to test their API. – StreetCoder Jan 07 '14 at 09:21
  • OK your composer is not working as expected. 1. check the version of composer(`composer -V`). 2. Check if there is a composer.lock on your project's root folder. 3. Check if you can run composer `composer require mailgun/mailgun-php=1.5` in a fresh new folder. – Ilan Frumer Jan 07 '14 at 09:55

2 Answers2

3

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"
    }
}
Community
  • 1
  • 1
Ilan Frumer
  • 32,059
  • 8
  • 70
  • 84
  • thanks to reply. I'll check your suggestion. ( I replied on your answer lately due to the reason unfortunately first time I did not get any notification over stackoverflow activity ) – StreetCoder Jan 07 '14 at 05:20
  • everything I have done you told but still finding an issues that is `The requested package mailgun/mailgun-php 1.0.0 could not be found.` – StreetCoder Jan 07 '14 at 07:25
1

composer require mailgun/mailgun-php:~1.7.1

Worked for me - Windows, XAMPP.

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

Spenny
  • 11
  • 1