第一次用composer 我用的laravel 已经装好composer了 在laravel项目的根目录下有一个composer.json文件 我想安装predis/predis应该怎么安装呢 这个包的命令是composer require predis/predis
我打开composer.json文件里面已经有内容了 我这句命令应该加到文件的哪里呢?
我在cmd里面输入这句话 然后结果是这个 这个是没有运行成功吧 不知道什么意思
下面是composer.json的内容
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
"require": {
"monolog/monolog": "1.0.*"
}
}
不需要手动加,直接在当前文件的目录中执行
composer require predis/predis
就可以自动添加到require
部分了。之后可能要执行
composer install
下载该依赖。