Installing Composer
Composer is the dependency manager for PHP. It is required to install and manage the packages your Laravel application depends on.
✅ Latest stable version: v2.9.7
Before installing Composer, make sure PHP is installed on your server. Refer to the Installation Guide for instructions.
1. Download & Install
Run the following script in your terminal to download and verify the installer:
bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"This will download the latest composer.phar into your current directory.
2. Install Globally
Move the binary to your PATH so composer is available from any directory:
bash
sudo mv composer.phar /usr/local/bin/composerVerify the installation:
bash
composer --version3. Install Project Dependencies
Navigate to your project root and run:
bash
composer install⚠️ Use
composer install— notcomposer update— in production to respect the locked versions incomposer.lock.
