crasivo/bitrix-console

Symfony console adapter for 1C-Bitrix

Fund package maintenance!
crasivo

0.0.1 2025-09-18 12:39 UTC

This package is auto-updated.

Last update: 2025-09-18 14:23:14 UTC


README

An adapter for the popular Symfony Console library in 1C-Bitrix & Bitrix24.

Minimum requirements for installation:

  • 1C-Bitrix kernel (main) version: v20.5.400
  • PHP version: v7.2
  • Symfony Console version: v5.0

🚀 Quick Start

To use the library, simply install the Composer package via the command:

$ cd /path/to/project
$ composer require crasivo/bitrix-console

The library is ready to use. The executable file is located in the vendor/bin/console folder. Below is an example command to get a list of all modules.

$ php vendor/bin/console list

đŸ•šī¸ Usage

Creating Commands

The process of creating commands for 1C-Bitrix (current adapter) is no different from Symfony. Command classes can be stored anywhere, including folders in a custom module. The only requirement for operation is visibility for Composer autoload.

Registering Commands

The library includes the CommandLocator class (analogous to the standard ServiceLocator), which loads commands from .settings.php configuration files. If your module is installed, the locator will also automatically load commands from it.

To register, simply define the console.commands section and specify a list of your commands in it. Below is an example of registering commands in various ways.

use Your\Awesome\Command;

return [
    'console' => [
        'value' => [
            'commands' => [
                Command::class, // simple (via class name)
                'some.command' => ['className' => Command::class], // classic
                'some.command' => ['constructor' => function () { return new Command(); }] // via constructor
            ],
        ],
        'readonly' => true,
    ],
];

📜 License

This project is distributed under the MIT license. The full text of the license can be found in the LICENSE file.