This article describes how to install and configure PHP Composer, the dependency manager solution. PHP Composer enables you to manage dependencies for each project independently, and is used by frameworks such as Laravel.
To install Composer PHP, follow these steps:
echo 'alias composer="php -d allow_url_fopen=On /home/username/composer.phar"' >> ~/.bashrc source ~/.bashrc
You can use composer with alternate PHP versions as well:
echo 'alias php="/opt/php/php-5.5.0/bin/php"' >> ~/.bashrc echo 'alias composer="/opt/php/php-5.5.0/bin/php -d allow_url_fopen=On /home/username/composer.phar"' >> ~/.bashrc source ~/.bashrc
For more information about how to use alternate PHP versions on A2 Hosting servers that do not use CageFS, please see this article.
To download the PHP Composer installer, type the following commands:
cd ~ curl -k -O https://getcomposer.org/installer
To install Composer PHP, type the following command:
php -d allow_url_fopen=On installer
Composer should display the version number. If it does not, repeat steps 2 to 4, paying close attention to the paths.
To update the composer installation to the newest version in the future, type the following command:
For more information about PHP Composer, please visit https://getcomposer.org.