Composer: Installing and Managing PHP Dependencies on a Server

PHP · 19.04.2026
Composer: Installing and Managing PHP Dependencies on a Server

What is Composer

Composer is the standard dependency manager for PHP. It lets you pull in third-party libraries (Laravel, Symfony, Guzzle, and thousands more) with a single command and handles autoloading automatically.

Install Composer on Ubuntu/Debian

curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer --version

Key Composer Commands

CommandDescription
composer installInstall dependencies from composer.lock
composer updateUpdate all dependencies
composer require vendor/pkgAdd a new package
composer dump-autoload -oRegenerate optimized autoloader

Production Optimization

composer install --no-dev --optimize-autoloader --no-interaction
Never run composer update on production. Update locally, commit composer.lock to git, deploy with composer install.
← Back to Knowledge Base Ask Support