Using PHP Composer in 1&1 IONOS Webhosting Packages

The text on this page was translated by translation software. A revised version from our editors will be available soon.

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 1&1 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.

Update PHP version

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.

Note: Almost all IONOSpackages 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 IONOShosting 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.

Download Composer
curl -sS | /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
/usr/bin/php7.1-cli composer.phar

As a result, you get an overview of all Composer commands.

Overview of all Composer commands in the shell

To always use the latest Composer version, use e.g. the following command:

/usr/bin/php7.1-cli composer.phar selfupdate

Important note:

The path to PHP-CLI in the above example is version dependent and may change!

We look forward to your feedback - are you already using Composer?

This article was published on 06 Nov 2018 by sebastian.zientek as part of the topic PHP ###ARTICLEINFO_SENTENCE_END###.