无法使用composer在Windows上安装Mailgun库

时间:2014-01-06 12:13:21

标签: windows composer-php mailgun

我一直在尝试使用composer在我的localhost中安装mailgun库。我在命令提示符下写了以下命令:

php composer require mailgun/mailgun-php:~1.3

它给我的错误为Could not open input file: composer

然后我尝试删除上一个命令开头的php

composer require mailgun/mailgun-php:~1.3

它显示:

./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.

我一直在努力安装mailgun几天,请帮助我。

更新

仅供参考:我使用的是使用xampp的Windows

composer.phar文件详细信息:

{
"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"
}

2 个答案:

答案 0 :(得分:3)

mailgun使用guzzle,需要 php&gt; = 5.3.3 卷曲扩展

执行以下操作:

  • 更新作曲家:composer self-update
  • 检查php版本:php -v
  • 安装curl扩展程序:[sudo] apt-get install php5-curl

如果您使用Windows,请尝试以下方法:

如果您仍然遇到composer require ...

错误
  • 如果存在,请从项目的根目录中删除“composer.lock”文件。
  • 在项目的根目录中创建“composer.json”文件,如下所示。
  • 运行composer install

// composer.json:

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

答案 1 :(得分:1)

作曲家需要mailgun / mailgun-php:~1.7.1

为我工作 - Windows,XAMPP。

找到你的php.ini并取消注释extension = php_curl.dll。