How to install composer
Composer is the standard tool for dependency management in PHP. It downloads and updates the libraries your project needs, based on a single configuration file. This guide shows you how to install Composer on your JetHost hosting account over SSH.
Before you start
On JetHost shared hosting, SSH is enabled by default, so you can connect right away. If you are not sure how, see our guide on how to use SSH. Once you are connected to the console, you are ready to install Composer.
Install Composer
First, download and run the official installer with a single command:
curl -sS https://getcomposer.org/installer | phpThis creates a file named composer.phar in your current directory. You can then run Composer like this:
php composer.phar --versionIf it prints a version number, Composer is installed and working.
Make Composer easier to run
Next, to run composer instead of php composer.phar, move it to a personal bin folder that is in your PATH:
mkdir -p ~/bin
mv composer.phar ~/bin/composerLog out and back in, then test it with composer --version. If the command is not found, add ~/bin to your PATH in your shell profile.
Using Composer
Finally, move into your project directory and run composer install to fetch the dependencies listed in your composer.json file, or composer require vendor/package to add a new one.
Composer records the exact versions it installs in a composer.lock file. Commit both composer.json and composer.lock to your project, so every environment installs the same versions. When you deploy, run composer install to match the lock file exactly, and use composer update only when you deliberately want newer versions.
Need more help?
Explore more Linux commands with examples, or get full root control to install tools system-wide with a JetHost VPS. If you run into a PHP version issue while installing Composer, our support team can help you choose the right one.


