PHP composer
is a popular dependency/package manager.
OpenBSD 6.4 provides the package of its 1.6.3 version.
How to install it:
# pkg_add composer
It's, however, based on PHP 7.0 whose support has come to an end.
It seems partially because:
not 7.2 yet as some things are still using mcrypt
Of course, the situation has been being improved by the great developers.
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 composer.phar
:
# 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
* Caution: 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
commands:
$ 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
Happy coding.