# pkg_add composer
not 7.2 yet as some things are still using mcrypt
Well, there might be some cases that using PHP greater than 7.0 is required (or just wanted) because of security issues, PHP extensions, dependencies or something else.
EC-CUBE, a Japanese eCommerce/cart system, is the case to me.
I found the way by using
# php-7.2 /usr/local/libexec/composer.phar [subcommands] ...
For example, installing EC-CUBE in my case is available with this command:
$ php-7.2 /usr/local/libexec/composer.phar create-project ec-cube/ec-cube ./ec-cube "4.0.x-dev" --keep-vcs
composer is recommended to be run in user mode.
Additionally, the path to
php is sometimes required through the execution.
The solution is to create a symbolic link:
# ln -s /usr/local/bin/php-7.2 /usr/local/bin/php
Now you can use
$ php /usr/local/libexec/composer.phar [subcommands] ...
Remove the link after using it as needed:
# rm /usr/local/bin/php
Besides, platform config of
composer like this might be sometimes helpful:
$ composer config platform.php 7.2.10 $ # or $ composer config --global platform.php 7.2.10