PHP code example of magnifico / bitrix-console
1. Go to this page and download the library: Download magnifico/bitrix-console library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
magnifico / bitrix-console example snippets
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('magnifico.console', 'OnBeforeRun', function(\Bitrix\Main\Event $event){
$app = $event->getParameter('app');
$app->add(new class() extends \Symfony\Component\Console\Command\Command {
protected function configure()
{
$this->setName('foobar');
}
});
});
# Определяем, где находится DOCUMENT_ROOT
$_SERVER['DOCUMENT_ROOT'] = '/home/bitrix/www';
# Включаем служебный скрипт, который сделает все остальное