skip to Main Content

I recently installed Laravel 11, but I’m encountering some issues. I noticed that some files such as Kernel.php, Middleware.php, and api.php are missing. Thinking there was a problem with my initial installation, I reinstalled Laravel 11, but the same files are still missing. Can anyone help me understand what might be going wrong?

I previously worked with Laravel 10 and recently upgraded to Laravel 11. Just installed Laravel 11 twice and encountered the same issue.

2

Answers


  1. In Laravel 11, the structure has been streamlined, leading to changes in how certain files are handled compared to Laravel 10.

    for middleware you can initiate making middleware like it used to using php artisan, and if you want to make the alias of the middleware, you can make it in bootstrap/app.php and make something like this

    ->withMiddleware(function (Middleware $middleware) {
        $middleware->alias([
            'checkrole' => AppHttpMiddlewareCheckRole::class,
        ]);
    })
    

    Regarding api.php, this file is no longer included by default in fresh installations. You can generate it by running: php artisan install:api

    here is something to read on
    route api laravel 11,

    kernel & middleware

    Login or Signup to reply.
  2. Since Laravel 11, there is no more Http Kernel file in the Http folder, and all necessary configurations have moved to the bootstrap/app.php file.

    Here is a Medium article that goes into further detail:

    https://rezakhademix.medium.com/laravel-11-no-http-kernel-no-casts-no-console-kernel-721c62adb6ef

    It is also mentioned in the middleware section of the Laravel 11 release notes:

    https://laravel.com/docs/11.x/releases#laravel-11

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search