Sooooo we needed to jump our local environment from PHP 7.4 to PHP 8.1 in order to work on a different project.
We started by running the command:
Valet use php@8.1
That provided the following error:
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.27. in /Users/sam/.composer/vendor/composer/platform_check.php on line 25
To fix this issue we ran:
brew link php
This command resulted in:
brew link php
Unlinking /usr/local/Cellar/php@7.4/7.4.27.reinstall... 25 symlinks removed.
Linking /usr/local/Cellar/php/8.1.2.reinstall... 24 symlinks created.
From there we could run “valet use php 8.2” and our new project was happy. This post was also super helpful, it provides solutions for a few other versions oh PHP so if anyone else out there is stuck you can try the link below:
https://dev.to/arielmejiadev/switch-to-older-php-versions-with-laravel-valet-33ph