Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
Using Composer 2 via SSH on your hosting
This guide explains how to run the open-source dependency manager Composer 2 using an SSH command.
Introduction
- Composer is an open-source dependency manager for PHP that allows you to define, install, and update the libraries required for a PHP project.
- Composer 1 has been deprecated since 2021 and no longer allows you to install new packages or perform updates since 2025.
- Only version 2 of Composer is now supported and available on all PHP versions from 7.2 to 8.3.
Run Composer 2
Composer 2 is already pre-installed and accessible via SSH. Therefore, there is no need to install it manually.
Simple usage
Connect to your hosting via SSH, then use the following command:
composerThis command will automatically execute Composer version 2, which is compatible with the PHP version currently in use in your session.
Check the active version
You can check the available Composer version with:
composer --versionExample output: Composer version 2.5.0 2022-12-20 10:44:08
Force a specific PHP version
If you want to run Composer with a specific PHP version, aliases are available. For example:
composer_php8.1 --versionor:
composer_php7.4These aliases allow you to run Composer 2 with the specified PHP interpreter, which is useful for testing or deploying a project on a target PHP version.
Link to this FAQ: https://faq.infomaniak.com/2118
Has this FAQ been helpful?