Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nitiphone's avatar

Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException PHP 7.3 is not supported.

Hi, My server is using PHP 7.3, How can i fix this error ?

0 likes
30 replies
Sinnbeck's avatar

Two suggestions

  1. Upgrade php
  2. Show the code that is throwing the error
nitiphone's avatar

@Sinnbeck I can't update PHP version. as This project I upload to Production server many time of this week. it's work but today after modify code and function and try again. it's error from Reipload I stuck on error message "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0"."

I tried to run "composer install --ignore-platform-reqs" but still error This is the result of composer update command

"Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
Class App\Http\Controllers\Management\TbUserController located in ./app/Http/Controllers/Management/tbUserController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Models\tbFarmergroup located in ./app/Models/tbFarmerGroup.php does not comply with psr-4 autoloading standard. Skipping.
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/sail
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
80 packages you are using are looking for funding.
Use the `composer fund` command to find out more!"
automica's avatar

@nitiphone in which case, find a version of the package that required 7.4 > and replace it with a version that matches your server php version.

nitiphone's avatar

@Sinnbeck

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "doctrine/dbal": "^3.1",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.40",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
nitiphone's avatar

composer.json As I compared this file with old project that I update yesterday. seem they are the same. I upload yesterday code to server again. it's work!!. I am so confuse why this new code can't work

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "doctrine/dbal": "^3.1",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.40",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
frankielee's avatar

Change the required php version

"require": { "php": "^7.3|^8.0", 

to

"require": { "php": "^7.3", 

after than, delete the vendor folder and composer.lock.

Run composer update

Edit: You can find the matching condition here.

Reference: https://getcomposer.org/doc/articles/versions.md#summary

Probably this is more suit your need

"~7.3"
nitiphone's avatar

@frankielee Still not work. As I install my old code of last week. the composer.json is the same like this folder. it can work normally. I am so confuse why my new code can't work

nitiphone's avatar

@frankielee Yes, I also don't know about it. today I reuse the old codeon the server. it still working fine. I compare composer.json. they are the same.

nitiphone's avatar

@frankielee If really not work. I will replace new to old code one by one directory. yea it's like impossible about it but it maybe find the root cause

nitiphone's avatar

@frankielee no, I never use docker. it's possible that I just copy my project to Server without run "composer update" again? normally the server and local are different PHP version

nitiphone's avatar

@frankielee I upload project to server, remove vendor and composer.lock after run "composer install --no-dev" website still show error interface

Laravel\SerializableClosure\Exceptions\
PhpVersionNotSupportedException
vendor/laravel/serializable-closure/src/SerializableClosure.php:59
vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php:22
composer install --no-dev
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 112 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (v2.0.3)
  - Locking brick/math (0.9.3)
  - Locking composer/package-versions-deprecated (1.11.99.4)
  - Locking doctrine/cache (2.1.1)
  - Locking doctrine/dbal (3.2.0)
  - Locking doctrine/deprecations (v0.5.3)
  - Locking doctrine/event-manager (1.1.1)
  - Locking doctrine/inflector (2.0.4)
  - Locking doctrine/instantiator (1.4.0)
  - Locking doctrine/lexer (1.2.1)
  - Locking dragonmantank/cron-expression (v3.1.0)
  - Locking egulias/email-validator (2.1.25)
  - Locking facade/flare-client-php (1.9.1)
  - Locking facade/ignition (2.17.2)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fakerphp/faker (v1.16.0)
  - Locking fideloper/proxy (4.4.1)
  - Locking filp/whoops (2.14.4)
  - Locking fruitcake/laravel-cors (v2.0.4)
  - Locking graham-campbell/result-type (v1.0.4)
  - Locking guzzlehttp/guzzle (7.4.0)
  - Locking guzzlehttp/promises (1.5.1)
  - Locking guzzlehttp/psr7 (2.1.0)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v8.74.0)
  - Locking laravel/sail (v1.12.9)
  - Locking laravel/serializable-closure (v1.0.5)
  - Locking laravel/tinker (v2.6.2)
  - Locking league/commonmark (1.6.6)
  - Locking league/flysystem (1.1.8)
  - Locking league/mime-type-detection (1.9.0)
  - Locking mockery/mockery (1.4.4)
  - Locking monolog/monolog (2.3.5)
  - Locking myclabs/deep-copy (1.10.2)
  - Locking nesbot/carbon (2.54.0)
  - Locking nikic/php-parser (v4.13.2)
  - Locking nunomaduro/collision (v5.10.0)
  - Locking opis/closure (3.6.2)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.1.0)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.3.0)
  - Locking phpdocumentor/type-resolver (1.5.1)
  - Locking phpoption/phpoption (1.8.0)
  - Locking phpspec/prophecy (1.14.0)
  - Locking phpunit/php-code-coverage (9.2.9)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.10)
  - Locking psr/cache (1.0.1)
  - Locking psr/container (1.1.1)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (1.1.4)
  - Locking psr/simple-cache (1.0.1)
  - Locking psy/psysh (v0.10.12)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.2.2)
  - Locking ramsey/uuid (4.2.3)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.6)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.3)
  - Locking sebastian/exporter (4.0.4)
  - Locking sebastian/global-state (5.0.3)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (2.3.4)
  - Locking sebastian/version (3.0.2)
  - Locking swiftmailer/swiftmailer (v6.3.0)
  - Locking symfony/console (v5.4.0)
  - Locking symfony/css-selector (v5.4.0)
  - Locking symfony/deprecation-contracts (v2.5.0)
  - Locking symfony/error-handler (v5.4.0)
  - Locking symfony/event-dispatcher (v5.4.0)
  - Locking symfony/event-dispatcher-contracts (v2.5.0)
  - Locking symfony/finder (v5.4.0)
  - Locking symfony/http-foundation (v5.4.0)
  - Locking symfony/http-kernel (v5.4.0)
  - Locking symfony/mime (v5.4.0)
  - Locking symfony/polyfill-ctype (v1.23.0)
  - Locking symfony/polyfill-iconv (v1.23.0)
  - Locking symfony/polyfill-intl-grapheme (v1.23.1)
  - Locking symfony/polyfill-intl-idn (v1.23.0)
  - Locking symfony/polyfill-intl-normalizer (v1.23.0)
  - Locking symfony/polyfill-mbstring (v1.23.1)
  - Locking symfony/polyfill-php72 (v1.23.0)
  - Locking symfony/polyfill-php73 (v1.23.0)
  - Locking symfony/polyfill-php80 (v1.23.1)
  - Locking symfony/polyfill-php81 (v1.23.0)
  - Locking symfony/process (v5.4.0)
  - Locking symfony/routing (v5.4.0)
  - Locking symfony/service-contracts (v2.5.0)
  - Locking symfony/string (v5.4.0)
  - Locking symfony/translation (v5.4.0)
  - Locking symfony/translation-contracts (v2.5.0)
  - Locking symfony/var-dumper (v5.4.0)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.3)
  - Locking vlucas/phpdotenv (v5.4.0)
  - Locking voku/portable-ascii (1.5.6)
  - Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file
Package operations: 72 installs, 0 updates, 0 removals
  - Installing composer/package-versions-deprecated (1.11.99.4): Extracting archive
  - Installing psr/log (1.1.4): Extracting archive
  - Installing psr/cache (1.0.1): Extracting archive
  - Installing doctrine/event-manager (1.1.1): Extracting archive
  - Installing doctrine/deprecations (v0.5.3): Extracting archive
  - Installing doctrine/cache (2.1.1): Extracting archive
  - Installing doctrine/dbal (3.2.0): Extracting archive
  - Installing doctrine/inflector (2.0.4): Extracting archive
  - Installing doctrine/lexer (1.2.1): Extracting archive
  - Installing symfony/polyfill-ctype (v1.23.0): Extracting archive
  - Installing webmozart/assert (1.10.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.1.0): Extracting archive
  - Installing voku/portable-ascii (1.5.6): Extracting archive
  - Installing symfony/polyfill-php80 (v1.23.1): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.23.1): Extracting archive
  - Installing phpoption/phpoption (1.8.0): Extracting archive
  - Installing graham-campbell/result-type (v1.0.4): Extracting archive
  - Installing vlucas/phpdotenv (v5.4.0): Extracting archive
  - Installing symfony/css-selector (v5.4.0): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (2.2.3): Extracting archive
  - Installing symfony/var-dumper (v5.4.0): Extracting archive
  - Installing symfony/deprecation-contracts (v2.5.0): Extracting archive
  - Installing symfony/routing (v5.4.0): Extracting archive
  - Installing symfony/process (v5.4.0): Extracting archive
  - Installing symfony/polyfill-php72 (v1.23.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.23.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.23.0): Extracting archive
  - Installing symfony/mime (v5.4.0): Extracting archive
  - Installing symfony/polyfill-php73 (v1.23.0): Extracting archive
  - Installing symfony/http-foundation (v5.4.0): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v2.5.0): Extracting archive
  - Installing symfony/event-dispatcher (v5.4.0): Extracting archive
  - Installing symfony/error-handler (v5.4.0): Extracting archive
  - Installing symfony/http-kernel (v5.4.0): Extracting archive
  - Installing symfony/finder (v5.4.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.23.1): Extracting archive
  - Installing symfony/string (v5.4.0): Extracting archive
  - Installing psr/container (1.1.1): Extracting archive
  - Installing symfony/service-contracts (v2.5.0): Extracting archive
  - Installing symfony/console (v5.4.0): Extracting archive
  - Installing symfony/polyfill-iconv (v1.23.0): Extracting archive
  - Installing egulias/email-validator (2.1.25): Extracting archive
  - Installing swiftmailer/swiftmailer (v6.3.0): Extracting archive
  - Installing symfony/polyfill-php81 (v1.23.0): Extracting archive
  - Installing ramsey/collection (1.2.2): Extracting archive
  - Installing brick/math (0.9.3): Extracting archive
  - Installing ramsey/uuid (4.2.3): Extracting archive
  - Installing psr/simple-cache (1.0.1): Extracting archive
  - Installing opis/closure (3.6.2): Extracting archive
  - Installing symfony/translation-contracts (v2.5.0): Extracting archive
  - Installing symfony/translation (v5.4.0): Extracting archive
  - Installing nesbot/carbon (2.54.0): Extracting archive
  - Installing monolog/monolog (2.3.5): Extracting archive
  - Installing league/mime-type-detection (1.9.0): Extracting archive
  - Installing league/flysystem (1.1.8): Extracting archive
  - Installing league/commonmark (1.6.6): Extracting archive
  - Installing laravel/serializable-closure (v1.0.5): Extracting archive
  - Installing laravel/framework (v8.74.0): Extracting archive
  - Installing fideloper/proxy (4.4.1): Extracting archive
  - Installing asm89/stack-cors (v2.0.3): Extracting archive
  - Installing fruitcake/laravel-cors (v2.0.4): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing psr/http-client (1.0.1): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-factory (1.0.1): Extracting archive
  - Installing guzzlehttp/psr7 (2.1.0): Extracting archive
  - Installing guzzlehttp/promises (1.5.1): Extracting archive
  - Installing guzzlehttp/guzzle (7.4.0): Extracting archive
  - Installing nikic/php-parser (v4.13.2): Extracting archive
  - Installing psy/psysh (v0.10.12): Extracting archive
  - Installing laravel/tinker (v2.6.2): Extracting archive
66 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
Class App\Http\Controllers\Management\TbUserController located in ./app/Http/Controllers/Management/tbUserController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Models\tbFarmergroup located in ./app/Models/tbFarmerGroup.php does not comply with psr-4 autoloading standard. Skipping.
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
52 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
frankielee's avatar

@nitiphone

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.

Looks at the error, it says the file composer.lock is missing.

Did you remove the file, or the file is not uploaded?

Also, compare both composer.json. Are the versions updated?

nitiphone's avatar

@frankielee I remove vendor directory and composer.lock before run "composer install --no-dev" and after check composer.json before and after run command are the same, nothing change

frankielee's avatar

@nitiphone

  • Locking nikic/php-parser (v4.13.2)

The dependencies is upgraded. Replace both files composer.json and composer.lock to the working version. Don't delete .lock file

nitiphone's avatar

@frankielee after remove vendor directory and run command again I got these error message

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - league/commonmark is locked to version 2.0.2 and an update of this package was not requested.
    - league/commonmark 2.0.2 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
  Problem 2
    - league/config is locked to version v1.1.1 and an update of this package was not requested.
    - league/config v1.1.1 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
  Problem 3
    - psr/container is locked to version 1.1.2 and an update of this package was not requested.
    - psr/container 1.1.2 requires php >=7.4.0 -> your php version (7.3.33) does not satisfy that requirement.
  Problem 4
    - league/commonmark 2.0.2 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
    - laravel/framework v8.74.0 requires league/commonmark ^1.3|^2.0.2 -> satisfiable by league/commonmark[2.0.2].
    - laravel/framework is locked to version v8.74.0 and an update of this package was not requested.
frankielee's avatar

@nitiphone

As I install my old code of last week. the composer.json is the same like this folder. it can work normally

How did you install the code? By uploading whole project files?

frankielee's avatar

@nitiphone Whole Project Files including the directory vendor?

What is the php version at your local computer?

Besides the differences in composer.json and composer.lock, what else you changed?

nitiphone's avatar

@frankielee I remove the vendor directory before run command "composer install --no-dev" my localhost is PHP Version 7.4.9. I change .env file for database information. other file not touch

frankielee's avatar

@nitiphone I am sorry, but this doesn't make any sense to me. You probably want to switch your local php version same as the server. And test the project at local

nitiphone's avatar

From compare result composer with old and new code New code result from composer update. It doesn't have these message

  - Upgrading laravel/framework (v8.73.2 => v8.74.0)
  - Upgrading laravel/sail (v1.12.8 => v1.12.9)
  - Upgrading laravel/serializable-closure (v1.0.4 => v1.0.5)
  - Upgrading nikic/php-parser (v4.13.1 => v4.13.2)
  - Downgrading psr/cache (3.0.0 => 1.0.1)
  - Downgrading psr/log (2.0.0 => 1.1.4)
  - Downgrading symfony/event-dispatcher (v6.0.0 => v5.4.0)
  - Downgrading symfony/event-dispatcher-contracts (v3.0.0 => v2.5.0)
  - Downgrading symfony/string (v6.0.0 => v5.4.0)
  - Downloading laravel/serializable-closure (v1.0.5)
  - Downloading laravel/framework (v8.74.0)
  - Downloading laravel/sail (v1.12.9)
  - Downloading nikic/php-parser (v4.13.2)
  - Downgrading psr/log (2.0.0 => 1.1.4): Extracting archive
  - Downgrading psr/cache (3.0.0 => 1.0.1): Extracting archive
  - Downgrading symfony/string (v6.0.0 => v5.4.0): Extracting archive
  - Downgrading symfony/event-dispatcher-contracts (v3.0.0 => v2.5.0): Extracting archive
  - Downgrading symfony/event-dispatcher (v6.0.0 => v5.4.0): Extracting archive
  - Upgrading laravel/serializable-closure (v1.0.4 => v1.0.5): Extracting archive
  - Upgrading laravel/framework (v8.73.2 => v8.74.0): Extracting archive
  - Upgrading laravel/sail (v1.12.8 => v1.12.9): Extracting archive
  - Upgrading nikic/php-parser (v4.13.1 => v4.13.2): Extracting archive
nitiphone's avatar

Error Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException PHP 7.3 is not supported.

vendor/laravel/serializable-closure/src/SerializableClosure.php:59
    /**
     * Gets the closure.
     *
     * @return \Closure
     */
    public function getClosure()
    {
        if (\PHP_VERSION_ID < 70400) {
            throw new PhpVersionNotSupportedException();
        }
        return $this->serializable->getClosure();
    }

twinwebdev's avatar

Oddly enough, I was able to fix this issue by clearing all of my caches. I needed to switch PHP versions, and that's when I encountered this error. I guess a serialized closure that was created in the previous version of PHP was cached.

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
MigsGit's avatar

Be careful using php artisan optimize, it will break your laravel project.

If your encountered this error, just run:

php artisan route:clear

Please or to participate in this conversation.