'API error when trying to update composer and php

I had this errror in first instance:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.27. in /opt/lampp/htdocs/proyectoCartas/vendor/composer/platform_check.php on line

later I solved it by adding

    "platform-check": false

in composer.json config object then i executed: php artisan config:cache php composer.phar dump-autoload

and still get this error, which I can't solve:

Fatal error: Uncaught TypeError: Return value of Illuminate\Container\Container::offsetGet() must be an instance of Illuminate\Container\mixed, instance of Illuminate\Events\Dispatcher returned in /opt/lampp/htdocs/proyectoCartas/vendor/laravel/framework/src/Illuminate/Container/Container.php:1417

Thanks in advance



Solution 1:[1]

Since you didn't say which version of Laravel you're using, I assume it's the latest (9). If so, you will have to update the PHP version, it has the minimum requirement of PHP version 8

Server requirements Laravel 9

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 renandmc