Composer in ISPmanager

Composer installs PHP libraries listed in composer.json. Packages go to the site vendor folder.

Enable Composer

  1. "Sites" → three dots on the site → "Edit".
  2. Expand the PHP handler block.
  3. Tick "Use PHP Composer".
  4. Click "Save".
"Use PHP Composer" checkbox
"Use PHP Composer" checkbox

The site menu gets items for configuration files, PHP-composer packages and PHP Composer install.

Composer items in the site menu
Composer items in the site menu

composer.json

  1. Site menu → configuration files.
  2. Add the dependencies. Example:
{
    "require": {
        "monolog/monolog": "^3.9"
    }
}
  1. Save. The panel only checks JSON syntax.
composer.json editor
composer.json editor

Install packages

  1. Site menu → "PHP Composer install".
  2. Confirm with "Install".
Installing dependencies
Installing dependencies

Installed packages: site menu → "View PHP-composer packages".

Installed packages
Installed packages

Load the autoloader in your code:

<?php
require __DIR__ . '/vendor/autoload.php';
The site uses a library from vendor
The site uses a library from vendor

Composer in the Shell client

Run composer require, composer update and other commands in the Shell client from the site menu. It opens in the site folder: Shell client.

composer require guzzlehttp/guzzle
composer update
Questions and answers
In the site menu: "Configuration files", "PHP Composer install" and "View PHP-composer packages".
In the site vendor folder. Load them with vendor/autoload.php.
Yes, in the Shell client from the site menu.