当我添加 bootstrap/app.php 行时,尝试将 Barryvdh\Debugbar 添加到 lumen 应用程序:
if (env('APP_DEBUG')) {
$app->register(Barryvdh\Debugbar\LumenServiceProvider::class);
$app->configure('debugbar');
}
我得到错误:
<!-- Argument 2 passed to Barryvdh\Debugbar\ServiceProvider::Barryvdh\Debugbar\{closure}() must be an instance of Illuminate\Foundation\Application, instance of Laravel\Lumen\Application given, called in /mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/illuminate/container/Container.php on line 767 (500 Internal Server Error) -->
In composer.json I upgraded tp latest packages:
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.3|^8.0",
"anik/form-request": "^4.3",
"cviebrock/eloquent-sluggable": "^8.0.8",
"dusterio/lumen-passport": "^0.3.4",
"flipbox/lumen-generator": "^8.2.2",
"illuminate/mail": "^8.70.2",
"illuminate/notifications": "^8.70.2",
"intervention/image": "^2.7.0",
"laravel/lumen-framework": "^8.3.1",
"league/flysystem": " ~1.1.5"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6.4",
"fakerphp/faker": "^1.16.0",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"files": [
"app/library/helper.php"
],
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
}
为什么会出现错误以及如何修复?
谢谢!