Lumen5.4升级Lumen5.5

修改 「composer.json」,然后运行 composer update

"require": {
    "php": ">=5.6.4",
    "laravel/lumen-framework": "5.4.*",
    "vlucas/phpdotenv": "~2.2",
    "dingo/api": "1.0.x@dev",
    "tymon/jwt-auth": "1.0.*@dev",
    "guzzlehttp/guzzle": "^6.2",
    "predis/predis": "^1.1",
    "illuminate/redis": "5.4.*"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "phpunit/phpunit": "~5.0",
    "mockery/mockery": "~0.9",
    "squizlabs/php_codesniffer": "^2.8",
    "laravel/tinker": "^1.0"
},
// 改为
"require": {
    "php": ">=7.0",
    "laravel/lumen-framework": "5.5.*",
    "vlucas/phpdotenv": "~2.2",
    "dingo/api": "1.0.x@dev",
    "tymon/jwt-auth": "1.0.*@dev",
    "guzzlehttp/guzzle": "^6.2",
    "predis/predis": "^1.1",
    "illuminate/redis": "5.5.*"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "phpunit/phpunit": "~6.0",
    "mockery/mockery": "~0.9",
    "squizlabs/php_codesniffer": "^2.8",
    "laravel/tinker": "^1.0"
},

修改 「bootstrap/app.php」 文件底部 $app->group([ 'namespace' => 'App\Http\Controllers' ], function ($app) { $version = config('api.version'); require DIR."/../routes/{$version}.php"; require DIR.'/../routes/web.php'; });

// 改为

$app->router->group(
    ['namespace' => 'App\Http\Controllers'
], function ($router) {
    $version = config('api.version');
    require __DIR__."/../routes/{$version}.php";
    require __DIR__.'/../routes/web.php';
});

修改 「routes/web.php」文件
$app->get('/', function () use ($app) {
    return $app->version();
});

// 改为

$router->get('/', function () use ($router) {
    return $router->app->version();
});
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3