Using the repository in the project
In order to use the installed dependencies in the project, fill in the path in the php section:
require_once('vendor/autoload.php');
An example of a PHP file adding lines to the log:
<?phprequire_once('vendor/autoload.php');use Monolog\Level;use Monolog\Logger;use Monolog\Handler\StreamHandler;$logger = new Logger('channel-name');$logger->pushHandler(new StreamHandler('app.log', Logger::DEBUG));$logger->info('This is log');$logger->warning('This is log warning');$logger->error('This is log error');?>
The repository used by default is repo.packagist.org.
In order to edit the configuration file:
- In the Main menu, choose Sites.
- Choose the necessary site and press PHP button.
- In the Advanced PHP Settings form that opens, press PHP Composer.
- In the form that opens, click on the Configuration File.
- Make the necessary changes and click Ok.
When saving, the correctness of the JSON format is checked and the execution of the install or update command with the dry-run key is emulated.
For example, the preliminary verification of the installation of dependencies:
/bin/sh -c cd\ /var/www/cm/data/www/example.com\;./composer.phar\ install\ --dry-run