我一直在尝试使用 composer 在我的本地主机上安装 mailgun 库。我在命令提示符下写了以下命令:
php composer 需要 mailgun/mailgun-php:~1.3
它给我的错误是 Could not open input file: composer
然后我尝试删除上一个命令开头的 php
:
composer 需要 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"
}
最佳答案
mailgun 使用 guzzle 需要 php>=5.3.3 和 curl extension
执行以下操作:
- 更新 Composer :
Composer self 更新
- 检查 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"
}
}
关于windows - 无法使用 Composer 在 Windows 上安装 Mailgun 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20949819/