我试图在Centos7 / PHP5.6上安装telegram-bot / api,运行“ php composer.phar require telegram-bot / api”时出现此错误
# php composer.phar require telegram-bot/api
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.3 for telegram-bot/api
./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
- Can only install one of: telegram-bot/api[v2.3.0, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.1, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.10, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.11, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.12, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.13, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.2, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.3, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.4, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.5, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.6, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.7, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.8, 1.0.x-dev].
- Can only install one of: telegram-bot/api[v2.3.9, 1.0.x-dev].
- Installation request for telegram-bot/api 1.0.x-dev -> satisfiable by telegram-bot/api[1.0.x-dev].
- Installation request for telegram-bot/api ^2.3 -> satisfiable by telegram-bot/api[v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.2, v2.3.3, v2.3.4, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9].
Installation failed, reverting ./composer.json to its original content.
编辑:按照olibiaz的建议,我要添加composer.json,该文件是使用此存储库https://github.com/TelegramBot/Api下载的:
{
"name": "telegram-bot/api",
"description": "PHP Wrapper for Telegram Bot API",
"keywords": [
"php",
"telegram",
"bot",
"bot api"
],
"homepage": "https://github.com/TelegramBot/Api",
"license": "MIT",
"authors": [
{
"name": "Ilya Gusev",
"email": "mail@igusev.ru",
"homepage": "https://php-cat.com",
"role": "Developer"
}
],
"require": {
"php" : ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit" : "~4.0",
"squizlabs/php_codesniffer": "2.*",
"codeception/codeception": "*"
},
"autoload": {
"psr-4": {
"TelegramBot\\Api\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"TelegramBot\\Api\\Test\\": "tests"
}
},
"scripts": {
"test": "phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
}
}
我尝试指定Telegram-bot / api的版本以使用v2.3.9,但仍然收到相同的错误:-只能安装以下之一:telegram-bot / api [v2.3.9,1.0.x-开发]。
我不知道我还缺少什么,我已经花了很多时间寻找解决方法
答案 0 :(得分:-1)
我将其更改为将composer.json中的名称更改为:
"name": "telegram-bot/api_project",