On my local machine I have MAMP PRO running, which allows the change of PHP version per project independently.
Composer is installed on a specific PHP version, but my project aren’t.
How would I use composer so that it will either use the PHP version of the local environment, or so that I can easily tell Composer that I am using PHP "x.x.x".
Thank you in advance!
2
Answers
You can do this using the
composer.phar
file downloaded for each project, rather than the global installation of composer.For example
php7.4 composer.phar install
or
php8.2 composer.phar install
or etc.For downloading composer.phar
ps: don’t forget to add composer.phar to gitignore.
I believe you’re looking for this thing: https://getcomposer.org/doc/06-config.md#platform