Managing PHP Project Dependencies with Composer

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.

    Add file composer.json to the root directory of your project and specify packages. You can use the 'composer init' command to create composer.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 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.
Managing PHP Project Dependencies with Composer Through Plesk UI

To find all applications that have composer.json, so that you can manage dependencies, click Scan in the Applications section. 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.jsonand composer.lock files remain in the application directory, so you can add the application to the list by clicking Scan.

  

  • 0 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Articoli Correlati

Web Applications

Web Applications You can significantly increase your website functionality by using different...

Installing Apps

Installing Apps Depending on your needs and expertise level, you can choose one of the following...

Managing Apps

Managing Apps Generally, all apps allow the configuration of their main parameters directly in...

Granting Auxiliary Users Access to Apps

Granting Auxiliary Users Access to Apps By default, after you install an app, only users with...

Linking Apps and Auxiliary User Accounts

Linking Apps and Auxiliary User Accounts Some apps let you create and manage user accounts...

Powered by WHMCompleteSolution