Composer can basically be used, but it is not directly available as a global command via SSH.
Instead, usage is done through the file composer.phar provided by Composer.
Note: Make sure you use the correct SSH port. In CloudPit, this is the default port 22. In the legacy control panel, use the port specified in the data sheet or in the SSH configuration.For more information, see here: How do I connect to my webspace via SSH?
First, connect to your webspace via SSH and switch to your project directory.
Then follow the installation steps from the official Composer website: https://getcomposer.org/download/
After installation, the file composer.phar will be in your project directory.
Since Composer is not available globally, the composer.phar file must be executed via PHP.
Example:
Standard command:
composer require symfony/dotenv
Adjusted command:
php composer.phar require symfony/dotenv
If you want to use a specific PHP version, you can specify it directly:
php8.2 composer.phar require symfony/dotenv