Composer

0. Introduction

composer is a PHP binary script and it's using Unix Shebang to define which interpreter for executing.

[email protected]:~# head /usr/local/bin/composer -n 5
#!/usr/bin/env php
<?php
/*
* This file is part of Composer.
*
/usr/bin/php7.1 /usr/local/bin/composer update

1. Execute composer with specific PHP version

So if you're running composer without any specific option, it will use your PHP version at /usr/bin/env php (which is your default PHP)

We can have many versions of PHP inside your Linux and you can flexible use which PHP version for executing as you want like this way:

[email protected]:~# /usr/bin/php7.1 /usr/local/bin/composer update

Or just

[email protected]:~# php7.1 /usr/local/bin/composer
[email protected]:~# php7.2 /usr/local/bin/composer
[email protected]:~# php7.3 composer
...

2. Check & find all installed PHP packages

[email protected]:~# ls /usr/bin/ | grep php
php
php5.6
php7.1
php7.2
php7.3
php-config
php-config7.1
phpdbg
phpdbg5.6
phpize
phpize7.1