1. Go to this page and download the library: Download cruide/qrcode-native-php 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/ */
cruide / qrcode-native-php example snippets
use Cruide\QrCode\QrCode;
$qr = QrCode::make('http://alex-tisch.ru');
echo $qr->toText(); // просмотр в терминале
$qr->saveSvg('code.svg'); // вектор для печати
$qr->savePng('code.png', 480); // растр (нужен GD)
$html = '<img src="' . $qr->toDataUri() . '">';
use Cruide\QrCode\ErrorCorrection;
use Cruide\QrCode\ProductLabel;
use Cruide\QrCode\QrCode;
$label = ProductLabel::make()
->name('Краска фасадная белая, 10 л')
->article('KR-1024')
->uuid('9f1c8a2e-4b7d-4e6a-9c3f-2d5a8b1c0e42')
->arrivedAt(new DateTimeImmutable('2026-08-08')) // или строку '2026-08-08'
->comment('Партия №5, склад Б')
->extra(['BATCH' => '2026-31', 'BIN' => 'B-14-03']); // доп. поля
$qr = QrCode::make($label)->setEcLevel(ErrorCorrection::M);
$qr->saveSvg('label.svg', moduleSize: 6);
$label->format(ProductLabel::FORMAT_LINES); // KEY:значение, по строке на поле
$label->format(ProductLabel::FORMAT_JSON); // {"NAME":"...","ART":"..."}
$label->format(ProductLabel::FORMAT_CSV); // значение|значение|значение...
$label->csvDelimiter(';'); // свой разделитель для CSV
$label->keys(['name' => 'ТОВАР']); // переопределить имена ключей
$qr = QrCode::make($payload)
->setEcLevel(ErrorCorrection::H) // L/M/Q/H, по умолчанию M
->setMinVersion(3) // минимальная версия (единый размер этикеток)
->setMask(4); // фиксированная маска вместо автоподбора