我正在使用Laravel 5.2版和Jenssegers MongoDB。我安装了两个并且工作正常但我必须使用任何其他库并在使用命令 composer update 之后在composer.json中进行了更改。使用此命令后自动删除Jenssegers MongoDB文件。我不知道为什么会这样。作曲家更新后为什么Jenssegers MongoDB文件自动删除?请建议我如何处理此事?
我的composer.json文件
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"acacha/admin-lte-template-laravel": "2.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/common_helper.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"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"
}
}
答案 0 :(得分:0)
在composer.json文件中写下此"jenssegers/mongodb": "*",
行: -
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"acacha/admin-lte-template-laravel": "2.*",
"jenssegers/mongodb": "*",
},
在config/app.php
Jenssegers\Mongodb\MongodbServiceProvider::class,
Jenssegers\Mongodb\Auth\PasswordResetServiceProvider,
然后转到终端中的项目根目录并运行命令composer update
。
在模型文件中,您需要在顶部添加以下行
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
参考: - documentation
答案 1 :(得分:0)
composer update --no-scripts
你可以停止运行脚本