Managing PHP Project Dependencies with Composer
Composer is a tool that helps find, install, and update library packages that your PHP project depends on. Libraries are installed in the project's root directory. The Composer utility is available as part of Plesk. You do not need to install Composer in your project manually. Plesk installs the updates for Composer once a week.
Composer uses two files for storing the list of modules necessary for the project:
composer.json- lists libraries on which your project depends directly.
composer.jsonto the root directory of your project and specify packages. You can use the '
composer init'command to create
composer.lock- lists all libraries on which the libraries in
composer.jsondepend directly and indirectly, thus containing all libraries necessary for your project.
For more information, refer to the Composer documentation at https://getcomposer.org/doc/.
Plesk offers two ways to use Composer:
- Through the command line. Refer to the Composer documentation for instructions.
Note: Use normal environment (not chrooted).
- Through Websites & Domains > Applications. See the instructions below.
Using the UI for Managing PHP Project Dependencies with Composer
To find all applications that have
composer.json, so that you can manage dependencies, click Scan in Websites & Domains > Applications. The applications will appear in the list in the Applications section. The commands described below are available only for applications with the
To install all modules necessary for your project, in Websites & Domains > Applications > Manage My Applications > click the application name in the list > Install Dependencies.
To update module dependencies, run Websites & Domains > Applications > Manage My Applications > click the application name > Update Dependencies.
The Edit Configuration button opens
composer.json in Plesk's Code Editor for manual editing.
Removing Dependencies Management from Your App
When you click Remove, the application no longer appears in the list of applications in My Apps. However, the
composer.lock files remain in the application directory, so you can add the application to the list by clicking Scan.
Leave your feedback on this topic here
If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.