Пример использования

<?php

use \Bitrix\Main\Loader;
use \Bitrix\Main\LoaderException;
use \Native\Tools\Dictionary;
use \Native\Tools\Generator;

require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php';

// Генерация и отображение QR-кода
try {
    if (Loader::includeModule('native.tools')) {
        $string = 'https://webco.io';
        $string = Generator::barcode($string, Dictionary::BARCODE_TYPE_QR, Dictionary::FORMAT_PNG, 400, 400);
        ?>
        <img src="<?= $string ?>" alt="">
        <?php
    }
} catch (LoaderException $e) {
    echo $e->getMessage();
}

require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/footer.php';

Last updated