* @copyright 2023 smiley * @license MIT */ declare(strict_types=1); use chillerlan\QRCode\{QRCode, QROptions}; use chillerlan\QRCode\Data\QRMatrix; use chillerlan\QRCode\Output\QRMarkupSVG; require_once __DIR__.'/../vendor/autoload.php'; $options = new QROptions; $options->version = 7; $options->outputInterface = QRMarkupSVG::class; $options->outputBase64 = false; $options->svgAddXmlHeader = false; $options->svgUseFillAttributes = false; $options->drawLightModules = false; $options->drawCircularModules = true; $options->circleRadius = 0.4; $options->connectPaths = true; $options->keepAsSquare = [ QRMatrix::M_FINDER_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT_DARK, ]; $options->svgDefs = ' '; $qrcode = (new QRCode($options))->addByteSegment('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); // render the SVG $svg_raw = $qrcode->render(); // switch to base64 output $options->outputBase64 = true; // render base64 $svg_base64 = $qrcode->render(); // dump the output header('Content-type: text/html'); ?> QRCode javascript canvas conversion example