PHP Package Management via Composer

Composer is the industry standard for managing libraries in PHP projects. It is pre-installed on our servers and can be used directly via the cPanel terminal or an SSH connection.

Prerequisite: To use Composer, you must have access to the Terminal in cPanel or be connected via SSH.

Common Commands

Navigate to your project directory (e.g., cd public_html) and use the following commands:

Command Function
composer install Installs all packages from the composer.lock file.
composer update Updates your packages to the latest versions.
composer require [name] Adds a new package to your project.

Troubleshooting: PHP Version

By default, Composer uses the system's PHP version in the terminal. If your project requires a different version (e.g., PHP 8.2), call the specific PHP interpreter directly:

ea-php82 /usr/local/bin/composer install

Tip: Always use Composer inside your project folder
to ensure a clean vendor structure.

Was this answer helpful? 0 Users Found This Useful (0 Votes)