Using PHP Composer in IONOS web hosting packages
PHP Composer (Composer) is a so-called "Dependency Management Tool", which makes it possible to reference external sources and libraries in your own PHP projects comfortably and to keep them up to date.
Many open source projects no longer deliver ZIP archives or other installation packages - but reference the respective GitHub repositories.
To be able to use Composer in IONOS web hosting and performance hosting packages, you need to know that Composer is not installed by default because it is a small PHP script itself, which requires a PHP interpreter. Therefore, we recommend that you upgrade your PHP version before downloading and running Composer.
Web hosting with a personal consultant!
Fast and scalable, including a free domain and email address, trust web hosting from IONOS!
Download and run PHP Composer
By default, Composer is not called in the Web browser, but via a Secure Shell access (SSH). In the Shell Access (SSH) with PuTTY guide, we describe how many IONOScustomers will proceed in such a case.
Almost all IONOS packages allow shell access via SSH. If your package does not support SSH access, it is best to switch to a different WebHosting contract, as Composer itself requires more resources.
To use Composer in your web IONOS hosting package, please log in via SSH and follow these steps. If you have any questions, please feel free to post them in the discussion of the article. PHP-Composer also offers extensive documentation in English.
curl -sS https://getcomposer.org/installer | /usr/bin/php7.1-cli
After that there is a composer.phar file in your webspace. If you now call composer.phar directly, you will get an error, because Composer does not automatically find the correct PHP version. Therefore, start the Composer for the first time as follows.
Start Composer for the first time
As a result, you get an overview of all Composer commands.
To always use the latest Composer version, use e.g. the following command:
/usr/bin/php7.1-cli composer.phar selfupdate
The path to PHP-CLI in the above example is version dependent and may change!