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.Add file
composer.json
to the root directory of your project and
specify packages. You can use the ‘composer init'
command to
createcomposer.json
. -
composer.lock
- lists all libraries on which the libraries in
composer.json
depend 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 composer.json
file.
Installing Dependencies
To install all modules necessary for your project, in Websites &
Domains > Applications > Manage My Applications > click the
application name in the list > Install Dependencies.
Updating Dependencies
To update module dependencies, run Websites & Domains >
Applications > Manage My Applications > click the application
name > Update Dependencies.
Editing 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.json
and
composer.lock
files remain in the application directory, so you can
add the application to the list by clicking Scan.