Contents
1. Find Composer Installation Path
Windows
Run the following command to check system paths:
php -r "echo getenv('PATH');"
Look for a path similar to:
C:\ProgramData\ComposerSetup\bin\
Or search for "composer" in the output.
linux
no need to search phar, we can use which
below
2. Run Composer Using a Specific PHP Version
Windows
Once you find the correct path, run:
C:\php83\php.exe C:\ProgramData\ComposerSetup\bin\composer.phar install
Replace C:\php83\php.exe
with your desired PHP version path.
Linux
php8.2 $(which composer) install
hax, temporary change PHP cli version
- on the opened cmd/shell, command this
$env:PATH = "C:\php83;" + $env:PATH