我有一个laravel项目,它在laravel 4.1.31上运行得很好,现在我的挑战是将该项目迁移到更高的版本,比如5.3。我开始遵循Laravel提供的升级指南
https://laravel.com/docs/5.3/upgrade升级- 4.2
我更改了关于composer的laravel版本。Json到4.2。*如下所示
我的作曲家。json文件
{
"require": {
"classpreloader/classpreloader": "1.0.2",
"d11wtq/boris":"1.0.8",
"filp/whoops":"1.0.10",
"ircmaxell/password-compat":"1.0.4",
"jeremeamia/SuperClosure":"1.0.2",
"laravel/framework":"4.2.*",
"monolog/monolog":"1.15.0",
"nesbot/carbon":"1.17.0",
"nikic/php-parser":"v0.9.5",
"patchwork/utf8":"v1.1.30",
"phpseclib/phpseclib":"0.3.10",
"predis/predis":"v0.8.7",
"psr/log":"1.0.0",
"spipu/html2pdf":"4.5.0",
"stack/builder":"1.0.3",
"swiftmailer/swiftmailer":"5.4.1",
"symfony/browser-kit":"2.4.10",
"symfony/console":"2.4.10",
"symfony/css-selector":"2.4.10",
"symfony/debug":"2.4.10",
"symfony/dom-crawler":"2.4.10",
"symfony/event-dispatcher":"2.7.3",
"symfony/filesystem":"2.7.3",
"symfony/finder":"2.4.10",
"symfony/http-foundation":"2.4.10",
"symfony/http-kernel":"2.4.10",
"symfony/process":"2.4.10",
"symfony/routing":"2.4.10",
"symfony/security-core":"2.4.10",
"symfony/translation":"2.4.10",
"tappleby/laravel-auth-token":"0.3.4",
"tecnickcom/tcpdf":"6.2.12",
"way/generators": "2.*"
},
"autoload": {
"files": [
"app/libraries/DashboardInit.php",
"app/libraries/MailSmsHandler.php",
"app/libraries/Twilio.php",
"app/libraries/class.phpmailer.php",
"app/libraries/class.smtp.php",
"app/libraries/php-excel.php"
],
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds"
]
},
"repositories": {
"packagist": { "url": "https://packagist.org", "type": "composer" }
}
}
在composer成功更新后,我按照文档添加了新的加密默认值到指定的app/config/app.php文件。接下来的步骤不适用于我的情况,所以我跳过了它们。
带着所有的兴奋,我运行了composer dump- autolload,然后我又运行了php artisan dump- autolload,一次又一次没有失败:):)
最后用我的项目url打开了chrome:(它加载了一个我不喜欢的页面,一开始是一个错误页面说
Symfony Component Debug Exception FatalErrorException (E_UNKNOWN)
它没有给出关于错误的太多信息。我试着用这段代码调试我的路由文件。
Route::get('/login', function(){
$environment = App::environment();
echo $d = class_exists('DashboardController');
$d = new DashboardController();
$c = get_declared_classes();
sort($c);
dd($c);
});
通过这个实验,我发现应用程序没有加载DashboardController,或任何其他控制器。我已经尝试了很多作曲家和工匠的缓存清理,优化,但没有运气到目前为止导致我张贴这个问题。
很高兴接受你们提供的所有帮助:)
更新编曲器。Json与静态文件细节解决了我的问题,应用程序被打破,因为这些加载文件类丢失,用于实例化其他控制器文件,而加载类。
谢谢你的时间。很抱歉因为这个愚蠢的问题耽误了你的时间。
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*",
"tappleby/laravel-auth-token": "0.3.*",
"spipu/html2pdf": "~4.5"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/libraries",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"files": [
"app/libraries/DashboardInit.php",
"app/libraries/MailSmsHandler.php",
"app/libraries/Twilio.php",
"app/libraries/class.phpmailer.php",
"app/libraries/class.smtp.php",
"app/libraries/php-excel.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}