Laravel 从 5.1 升级到 5.2.0 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35151478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel Upgrading To 5.2.0 From 5.1 error
提问by Kiren Siva
Getting the error on composer update
command.
获取composer update
命令错误。
My composer.json file is:
我的 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.*",
"illuminate/html": "^5.0",
"barryvdh/laravel-debugbar": "~2.0",
"spatie/laravel-paginateroute": "^2.0",
"darkaonline/l5-swagger": "~2.0",
"yajra/laravel-datatables-oracle": "~5.0",
"phpoffice/phpexcel": "^1.8"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0"
},
"autoload": {
"classmap": [
"database"
],
"files": ["app/Helpers/helpers.php"],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
回答by Thomas Kim
You need to remove this outdated package (taken out of the core and no longer supported):
您需要删除这个过时的包(从核心中取出,不再受支持):
"illuminate/html": "^5.0",
When you remove it, you need to also remove its service providers / aliases. So, if you open up config/app.php
, you will see a providers and aliases section. Remove these lines of code if you haven't done so already.
删除它时,您还需要删除其服务提供者/别名。因此,如果您打开config/app.php
,您将看到提供者和别名部分。如果您还没有这样做,请删除这些代码行。
'Illuminate\Html\HtmlServiceProvider'
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade',
In place of it, you should install the Laravel collective package. To install that, replace the illuminate/html
package with this:
取而代之的是,您应该安装 Laravel 集合包。要安装它,illuminate/html
用这个替换包:
"laravelcollective/html": "5.2.*"
Then in your config/app.php
file, add this to your providers array:
然后在您的config/app.php
文件中,将其添加到您的 providers 数组中:
Collective\Html\HtmlServiceProvider::class
and this to your aliases array:
这到你的别名数组:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
The docs can be found here: https://laravelcollective.com/docs/5.2/html
文档可以在这里找到:https: //laravelcollective.com/docs/5.2/html
回答by Mainpixel.io
Quote "bindShared has been renamed to $app->singleton()"
引用“bindShared 已重命名为 $app->singleton()”
[Edit]I think you have something is your own custom code what need to be changed from : $this->app->bindShared() to: $this->app->singleton().
[编辑]我认为你有一些东西是你自己的自定义代码,需要从:$this->app->bindShared() 更改为:$this->app->singleton()。
回答by Kiren Siva
I solved it by the steps mentioned in Link1Link2
After the upgrade please make sure all the Deprecationsmentioned in Link2 are corrected in your current app. For me Illuminate\Contracts\Routing\Middleware
had to be removed from all the Middlewares.
升级后,请确保在您当前的应用程序中更正了 Link2 中提到的所有弃用。对我来说Illuminate\Contracts\Routing\Middleware
,必须从所有中间件中删除。
Also I had to install latest version of certain packages like "yajra/laravel-datatables-oracle": "~6.1.1",
我还必须安装某些软件包的最新版本,例如 "yajra/laravel-datatables-oracle": "~6.1.1",