Plesk extensions can use Composer to install and manage dependencies. Detailed information on Composer is available at the web site:

This section explains how to properly configure your extension in case it uses the Composer dependencies manager.

To illustrate the subject, the following sample project is provided by Plesk:

Setting Up

The basics of configuring your project to use Composer are described in section composer.json: Project Setup of the Composer documentation. The following configuration options are necessary to ensure integration with Plesk.

Sample composer.json file.

‘vendors’ directory location

It is recommended that the vendor/ directory be placed as follows:

"config": {
    "vendor-dir": "src/plib/vendor"

Using Namespaces

By default, we require using Class Naming Conventions when developing extensions to ensure that they work correctly with Plesk. Using Composer allows to use namespaces instead of long names required by the Class Naming Convention.

Just make sure the used namespaces are correctly loaded in composer.json.

"autoload": {
        "psr-0": {
                "Composer_": [
        "psr-4": {
                "PleskExt\\Composer\\": [

More information about namespaces is available in the section Autoloading of the Composer documentation.

Packing the Extension

The process of packing the extension using Composer requires one additional step, compared to the usual process.

Installing Dependencies

First, all the required dependencies must be downloaded and installed. To do that, run the following command:

composer --no-dev install

Note: --no-dev option is used to install only the libraries required for the production version, all other dependencies and rules used for development and testing purposes are omitted.

More information on installing dependencies is available in the section Installing Dependencies of the Composer documentation.

Creating the package

Once the dependencies are installed, you may proceed to create the extension ZIP archive.