> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing composer

> Learn how to install and configure composer, a PHP dependency manager.

This article describes how to install and configure [composer](https://getcomposer.org), the dependency manager solution for PHP. Composer enables you to manage dependencies for each project independently, and is used by frameworks such as [Laravel](/docs/laravel).

## Installing composer

To install composer, follow these steps:

1. Log in to your account [using SSH](/docs/using-ssh-secure-shell).

2. To download and install composer, type the following commands:

   ```bash theme={null}
   cd ~
   mkdir -p ~/bin
   wget https://getcomposer.org/installer -O composer-setup.php
   php ~/composer-setup.php --install-dir=$HOME/bin --filename=composer.phar
   ```

   > 📘 Note
   >
   > To confirm composer installed correctly, type the following command:
   >
   > ```bash theme={null}
   > ls -lh ~/bin/composer.phar
   > ```
   >
   > The *composer.phar* file should be listed in the *\~/bin* directory.

3. To create a helper script to run composer, type the following command:

   ```bash theme={null}
   cat > ~/bin/composer << 'EOF'
   #!/bin/bash
   php $HOME/bin/composer.phar "$@"
   EOF
   ```

4. To make the helper script executable, type the following command:

   ```bash theme={null}
   chmod +x ~/bin/composer
   ```

5. To configure your shell environment so you can run composer from any directory, type the following commands:

   ```bash theme={null}
   echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_profile
   source ~/.bash_profile
   ```

   > 📘 Note
   >
   > * To confirm composer is configured correctly, type the following command from any directory:
   >
   >   ```bash theme={null}
   >   composer -V
   >   ```
   >
   >   Composer should display the version number.
   >
   > * In the future, to update the composer installation to the newest version, type the following command:
   >
   >   ```bash theme={null}
   >   composer self-update
   >   ```

## More information

For more information about PHP Composer, go to [https://getcomposer.org](https://getcomposer.org).
