The updated Laravel 11 is causing significant issues for me. There are no kernel.php files, and some service provider files are missing as well. I have to manually add the kernel, and every time I make adjustments in my bootstrap/app.php file, the artisan file throws an error. I can’t even run the php artisan command without encountering an error. Here is the code in my app.php file inside the bootstrap directory.
$app = Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function ($middleware) {
$middleware->add(AppHttpMiddlewareCheckUserType::class);
$middleware->add(AppHttpMiddlewareStudentMiddleware::class);
$middleware->add(AppHttpMiddlewareTeacherMiddleware::class);
$middleware->add(AppHttpMiddlewareAdminMiddleware::class);
})
->withExceptions(function (Exceptions $exceptions) {
//
})
->create();
$app->register(AppServiceProvider::class);
$app->singleton(
IlluminateContractsHttpKernel::class,
AppHttpKernel::class
);
**This is the error: **
`PHP Fatal error: Uncaught Error: Call to a member function handleCommand() on int in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan:13
Stack trace:
#0 {main}
thrown in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan on line 13
n:13
Stack trace:
#0 {main}
thrown in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan on line 13
PS C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_university> php artisan serve
line 19
Fatal error: Cannot use “::class” on value of type string in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universitybootstrapapp.php on line
19
PS C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_university> php artisan
PHP Fatal error: Uncaught Error: Call to a member function handleCommand() on int in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan:13
Stack trace:
#0 {main}
thrown in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan on line 13
n:13
Stack trace:
#0 {main}
thrown in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan on line 13
PS C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_university> php artisan
PHP Fatal error: Uncaught Error: Call to a member function handleCommand() on int in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan:13
Stack trace:
#0 {main}
thrown in C:Classes3rd year2nd semCCS 106LaravelFINAL PROJECTgrand_line_universityartisan on line 13
`
I am new at laravel, this is really hard.
I tried to manually add the kernel and have to adjust the bootstrap->app.php. But when I modified it especially the middleware part, the artisan file got modified also maybe because even tho I undo the changes, the artisan command still wont run because it says it had error in line 13 artisan file.
June Udtohan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.