Modern PHP applications – Laravel, Symfony, Magento, many custom projects – rely on Composer to install their libraries. Plesk offers a PHP Composer extension that reads your composer.json and installs packages with a click, using the same PHP version as your site.
Before you start
- Administrators: install PHP Composer from Extensions → Extensions Catalog.
- Your project files uploaded (via Git, FTP or File Manager), including
composer.jsonand ideallycomposer.lock. Do not upload thevendorfolder.
Install dependencies
- Go to Websites & Domains and open the domain.
- Click PHP Composer.
- Plesk scans the subscription and lists detected
composer.jsonfiles. Select your project if there are several. - Check the PHP version used for Composer – it should match the site's version.
- Click Install. Composer installs exactly the versions in
composer.lock.
The packages and their versions are listed afterwards, with markers for available updates.
Update packages
Click Update to resolve newer versions allowed by composer.json and rewrite composer.lock. Do this on staging first – updates can introduce breaking changes. On production, prefer Install with a tested lock file. See staging in Plesk.
Settings
- Production mode (no dev dependencies) – enable for live sites; equals
--no-dev. - Optimize autoloader – faster class loading in production.
- Environment variables – add variables some packages need during install, such as authentication tokens for private repositories.
- Edit composer.json directly from the extension when you need to add a package.
Run Composer over SSH
With SSH access (see SSH in Plesk), use the Plesk PHP binary that matches the site:
/opt/plesk/php/8.3/bin/php /usr/lib/plesk-9.0/composer.phar install --no-dev -oThe path to composer.phar may differ; the extension shows it, or you can download Composer into your home directory. Running from the terminal gives full output, which helps with errors.
Automate on deploy
Add composer install --no-dev --optimize-autoloader to the Git extension's deployment actions or the Laravel Toolkit's deploy script so every push installs dependencies. See Git deployment and Laravel Toolkit.
Troubleshooting
- Allowed memory size exhausted: run with more memory:
php -d memory_limit=-1 composer.phar install, or raise the PHP memory limit. - Requires PHP extension X: enable the extension for that PHP version (administrator), or choose a PHP version that has it.
- Your requirements could not be resolved: the lock file was generated on a different PHP version; regenerate it with the target version.
- Authentication required: add credentials for private repositories as environment variables or
auth.json.
