PHPackages                             dvasilenko/alterego\_tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dvasilenko/alterego\_tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dvasilenko/alterego\_tools
==========================

Useful utilities

021PHP

Since Oct 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/denis-vasilenko/tools)[ Packagist](https://packagist.org/packages/dvasilenko/alterego_tools)[ RSS](/packages/dvasilenko-alterego-tools/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Для генерации JavaScript обработчика ошибок

```
use Alterego\Tools\Monitoring\ {
    Js,
    Options
};

$options = [
    'cookieKey' => 'jsmonitor',
    'handler' => '/js_server.php',
    'userId' => 1000,
];
$jsObj = new Js(
    new Options($options)
);

```

Вывод JS в шаблоне

```
echo $jsObj->getJs();

```

Обработка на стороне сервера

```
use Alterego\Tools\Monitoring\ {
    Js,
    Data,
    Options
};

$options = [
    'cookieKey' => 'jsmonitor',
    'appName' => 'Test',
    'logPath' => $_SERVER['DOCUMENT_ROOT'] . '/test/upload/logs/monolog/kibana/app.log',
];
$jsObj = new Js(
    new Options($options)
);

$data = Data::createFromArray($_REQUEST);
// При необходимости
$data->setSiteId('s1');

$jsObj->handler($data);

```

Логирование

```
use Alterego\Tools\Logger\Logger;

$logger = new Logger($dirLog);// по умолчанию $_SERVER['DOCUMENT_ROOT'] . '/upload/logs/'

// пример вызова
$logger->addLog($pointname, $data = []);
// psr
$logger->debug($message, $context = []);
$logger->info($message, $context = []);
$logger->notice($message, $context = []);
$logger->warning($message, $context = []);
$logger->error($message, $context = []);
$logger->critical($message, $context = []);
$logger->alert($message, $context = []);
$logger->emergency($message, $context = []);

```

Методы для работы и инфоблоками и свойствами 1C-Bitrix

```
use Alterego\Tools\Bitrix\Common;

// получаем список значений пользовательского поля типа список
Common::getEnumValueListById(int $fieldId): array

// Получаем значение списка
Common::getEnumValueById(int $id, bool $getXml = false): ?string

// Получаем список вариантов для пользовательского поля по ID
Common::getUserFieldVariantsById(int $fieldId, array $listId = []): array

// Получаем список вариантов для пользовательского поля по объекту и символьному коду поля
Common::getUserFieldVariants(string $entityId, string $fieldCode, array $listId = [], bool $getXmlKey = false): array

// Получаем ID элемента списка по XML_ID
Common::getEnumIdByXmlId(string $entityId, string $fieldCode, string $xmlId, array $listId = []): int

// Получаем название свойства инфоблока по коду
Common::getPropertyLabel(int $iblockId, int $elementId, string $propertyCode): ?string

// Получаем ID элемента свойства типа список по XML_ID
Common::getPropertyEnumIdByXmlId(int $iblockId, string $fieldCode, string $xmlId): int

// Получаем XML_ID элемента свойства типа список по ID
Common::getPropertyEnumXmlIdById(int $iblockId, string $fieldCode, int $id): string

// Получаем идентификатор инфоблока по символьному коду
Common::getIblockIdByCode(string $code, int $defaultId = 0, bool $checkPermission = false): int

// Получаем идентификатор элемента инфоблока по символьному коду
Common::getIblockElementIdByCode(string $code, int $defaultId = 0, bool $checkPermission = false): int

```

Методы для работы и инфоблоками и свойствами Bitrix24

```
use Alterego\Tools\Bitrix24\Common;

// Получаем название стадии сделки по идентификатору стадии
Common::getStageNameById($stageId): ?string

// Получаем первое значение мультиполя сущности crm
Common::getMultiField(string $entity, string $field, int $id): ?string

// Получаем список значений мультиполя сущности crm
Common::getMultiFields(string $entity, string $field, int $id): array

// Ищем сущность по номеру телефона (должен начинаться на +7|7|8)
Common::getContactsByPhone(string $phone, string $entity): array

// Получаем список статусов / стадий в зависимости от справочника
// STATUS / DEAL_STAGE / SOURCE / INVOICE_STATUS и др
Common::getCrmStatusByEntityId(string $entityId): array

```

Тестирование компонентов Bitrix

```
use Alterego\Tools\Bitrix\Common;
use Alterego\Tools\Exception\PathNotFoundException;

try {
    $componentObj = Common::initComponent('namespace:componentName');
    $arResult = $componentObj->exec();
} catch (PathNotFoundException $e){

}

```

Получить рекомендацию по полям HighLoad блоков

```
use Alterego\Tools\Bitrix\Db {
    HighLoadHelper,
    Db
};

$HighLoadHelper = new HighLoadHelper;
$HighLoadHelper->setDb(new Db);// Наследует системный класс CDatabase Bitrix

// проверить все HL блоки по связанным полям
$result = $HighLoadHelper->checkHighLoadTables();

// проверить произвольную таблицу с произвольными полями для которых должен быть индекс
$result = $HighLoadHelper->checkTableFields('имя_таблицы', [/*массив полей*/]);

```

Общее

```
use Alterego\Tools\Utility\Common;

// Вывод суммы прописью
Common::amount2str(1050.10, true);

// Очистка номера телефона от лишних символов
Common::clearPhone('9(25)000-00-00');// 79250000000
Common::clearPhone('89(25)000-00-00', '+');// +79250000000

// Начало слова с заглавной буквы для мультибайтовой кодировки
Common::mbucfirst('текст');// Текст

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1615816?v=4)[denis-vasilenko](/maintainers/denis-vasilenko)[@denis-vasilenko](https://github.com/denis-vasilenko)

### Embed Badge

![Health badge](/badges/dvasilenko-alterego-tools/health.svg)

```
[![Health](https://phpackages.com/badges/dvasilenko-alterego-tools/health.svg)](https://phpackages.com/packages/dvasilenko-alterego-tools)
```

###  Alternatives

[solarissmoke/disable-comments-mu

This is the must-use version of the Disable Comments WordPress plugin. Copy the contents of this directory into your mu-plugins directory in order to disable comments on the entire site/network, without any configuration. You should delete all existing comments from the WordPress database before activating this plugin. If you want to be able to configure the plugin's behaviour, then use the normal version.

6569.4k](/packages/solarissmoke-disable-comments-mu)[dstuecken/php7ify

php7ify is a project that brings new php7 classes and exceptions to php 5.x.

11158.4k1](/packages/dstuecken-php7ify)[thiktak/filament-nested-builder-form

Plugin for FilamentPHP - Nested Builder Form Component

208.9k1](/packages/thiktak-filament-nested-builder-form)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
