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

ChrisF79's avatar

Cannot install Laravel Valet using composer on a Mac.

I'm trying to install Laravel Valet using the instructions on the Laravel site. I'm running PHP 8.4.3 that I installed with brew.

When I run valet install I get the following error:

➜  ~ valet install
PHP Deprecated:  getPhpExecutablePath(): Implicitly marking parameter $phpFormulaName as nullable is deprecated, the explicit nullable type must be used instead in /Users/chris/.composer/vendor/laravel/valet/find-usable-php.php on line 55
Error finding executable PHP. Quitting for safety.
Provided output from find-usable-php.php:
Deprecated: getPhpExecutablePath(): Implicitly marking parameter $phpFormulaName as nullable is deprecated, the explicit nullable type must be used instead in /Users/chris/.composer/vendor/laravel/valet/find-usable-php.php on line 55 /opt/homebrew/bin/php
0 likes
2 replies
LaryAI's avatar
Level 58

The error you're encountering is related to a deprecated PHP feature in the Laravel Valet codebase. This is likely due to using a version of PHP that is not yet fully supported by Valet. Here are some steps you can take to resolve this issue:

  1. Check PHP Version Compatibility: Ensure that the version of PHP you are using is compatible with Laravel Valet. As of my last update, PHP 8.4 does not exist, so you might be using a version that is not officially released or supported. Consider downgrading to a stable version like PHP 8.1 or 8.0.

  2. Switch PHP Versions: Use Homebrew to switch to a different PHP version. You can do this by unlinking the current version and linking a different one. For example, to switch to PHP 8.1:

    brew unlink php
    brew install [email protected]
    brew link --force --overwrite [email protected]
    
  3. Update Composer and Valet: Make sure you have the latest versions of Composer and Laravel Valet. Run the following commands to update them:

    composer global update
    
  4. Reinstall Valet: If the issue persists, try reinstalling Valet:

    composer global remove laravel/valet
    composer global require laravel/valet
    valet install
    
  5. Check for Valet Updates: Sometimes, the issue might be resolved in a newer version of Valet. Check the Valet GitHub repository for any updates or patches that address this issue.

  6. Modify the Code (Temporary Fix): If you're comfortable with PHP, you can temporarily modify the find-usable-php.php file to explicitly declare the nullable type. However, this is not recommended for long-term use as it might break with future updates.

If none of these solutions work, consider checking the Laravel Valet GitHub issues page or forums for any similar issues and potential fixes.

RemiM's avatar

Until recently, Valet wasn't compatible with PHP 8.4, but they fixed it in late November. You can try updating Valet globally and reinstalling it with:

composer global update laravel/valet
valet install

Please or to participate in this conversation.