laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 420 forks source link

Laravel Lumen Error Call to undefined method Laravel\Lumen\Routing\Router::middleware() #1267

Closed pmediavictor closed 1 year ago

pmediavictor commented 1 year ago

Here is my composer.json. I was trying to upgrade Lumen to a new version after the PHP upgrade.

{
    "name": "laravel/lumen",
    "description": "The Laravel Lumen Framework.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^8.2",
        "dusterio/lumen-passport": "^0.3.6",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/lumen-framework": "9.1.*",
        "league/flysystem": " ~1.0"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.4.4",
        "phpunit/phpunit": "^10.0"
    },
     "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Everything upgraded successfully but when I run any artisan command I am getting the following error always.

In Facade.php line 338:
Call to undefined method Laravel\Lumen\Routing\Router::middleware()

If I run any artisan command, it always throws an error above.

driesvints commented 1 year ago

Lumen uses a different router than laravel so this isn't available. Please upgrade your app to the Laravel framework.

pmediavictor commented 1 year ago

@driesvints Do you mean we no longer use the lumen framework? I am not clear.

driesvints commented 1 year ago

Hi @pmediavictor. I'm sorry, I see this method is still available in lumen router so this should work. Nothing has changed really.

I just suggest to switch to Laravel because we very much disadvice using it any longer. You can use the Lumen to Laravel shift for $5: https://laravelshift.com/convert-lumen-to-laravel

pmediavictor commented 1 year ago

@driesvints So laravel/lumen is going to stop working further? And also you guys are going to stop upgrading the framework?

driesvints commented 1 year ago

For now we will still provide version updates.