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

ethor's avatar
Level 1

Laravel valet - error composer php version dependency

I get the following composer error message on one of my sites: Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0". You are running 7.4.14.

When i run php -v, I get: PHP 8.0.1 (cli) (built: Jan 8 2021 12:43:54) ( NTS )

I have tried removing the vendor folder and then reinstalling it using php 8, but I still get the same error message. I have also tried adding: "platform-check": false

to the config in composer.json.

Have anyone seen (and solved) this problem?

0 likes
4 replies
Sinnbeck's avatar

Check if the project has a .valetphprc file with a php version defined

ethor's avatar
Level 1

@Sinnbeck There is no such file @johnson8 I tried using your solution but now I get the following error message:

syntax error, unexpected '|', expecting variable (T_VARIABLE) in [...] vendor/psr/log/src/LoggerInterface.php on line 30 PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0

ethor's avatar
ethor
OP
Best Answer
Level 1

Very strange. Valet was according to phpinfo() still loading php 7.4 even though according to valet in the command line, php 8.0 was used. When i reloaded php version using --force it changed to 8.0 and now it is working?

Please or to participate in this conversation.