我有一个laravel项目,在 laravel 4.1.31 上运行完全正常,现在我的挑战是将该项目迁移到更高版本说5.3。我开始关注Laravel在以下链接上提供的升级指南
https://laravel.com/docs/5.3/upgrade#upgrade-4.2
我将composer.json上的laravel版本更改为4.2。*,如下所示
我的composer.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" }
}
}
成功作曲家更新后,我按照文档将新的加密默认值添加到指定的 app / config / app.php 文件中。并且接下来的步骤在我的情况下不适用所以我跳过它们。
随着所有的兴奋,我运行composer dump-autoload然后我也一次又一次地运行php artisan dump-autoload :) :)
最后勇敢地用我的项目url打开了chrome :(它加载了一个我最初不喜欢的页面,一个Whoops错误页面说
Symfony \ Component \ Debug \ Exception \ FatalErrorException(E_UNKNOWN)
它没有提供有关错误的更多信息。我尝试使用此代码调试我的routes文件。
Route::get('/login', function(){
$environment = App::environment();
echo $d = class_exists('DashboardController');
$d = new DashboardController();
$c = get_declared_classes();
sort($c);
dd($c);
});
通过这个实验,我发现应用程序没有加载 DashboardController 或任何其他控制器。我已经尝试了很多关于作曲家和工匠缓存清理的东西,优化但到目前为止没有运气让我发布这个问题。
很高兴接受人们提供的所有帮助:)
答案 0 :(得分:0)
使用静态文件详细信息更新我的composer.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"
}