Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Qrcode Laravel Package

chillerlan/php-qrcode

Generate and read QR codes in PHP. Supports Model 2 QR codes (versions 1–40), ECC levels L/M/Q/H, mixed encoding modes, and multiple output formats. Includes a QR code reader based on a PHP port of ZXing.

View on GitHub
Deep Wiki
Context7

QRMarkupSVG

Class QRMarkupSVG: Scalable Vector Graphics (SVG) output.

Example

See: SVG example

Set the options:

$options = new QROptions;

$options->version              = 7;
$options->outputInterface      = QRMarkupSVG::class;
// if set to false, the light modules won't be rendered
$options->drawLightModules     = true;
$options->svgUseFillAttributes = true;
// draw the modules as circles isntead of squares
$options->drawCircularModules  = true;
$options->circleRadius         = 0.4;
// connect paths to avoid render glitches
// [@see](https://github.com/see) https://github.com/chillerlan/php-qrcode/issues/57
$options->connectPaths         = true;
// keep modules of these types as square
$options->keepAsSquare         = [
	QRMatrix::M_FINDER_DARK,
	QRMatrix::M_FINDER_DOT,
	QRMatrix::M_ALIGNMENT_DARK,
];
// add a gradient via the <defs> element
// [@see](https://github.com/see) https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs
// [@see](https://github.com/see) https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
$options->svgDefs             = '
	<linearGradient id="rainbow" x1="1" y2="1">
		<stop stop-color="#e2453c" offset="0"/>
		<stop stop-color="#e07e39" offset="0.2"/>
		<stop stop-color="#e5d667" offset="0.4"/>
		<stop stop-color="#51b95b" offset="0.6"/>
		<stop stop-color="#1e72b7" offset="0.8"/>
		<stop stop-color="#6f5ba7" offset="1"/>
	</linearGradient>
	<style><![CDATA[
		.dark{fill: url(#rainbow);}
		.light{fill: #eee;}
	]]></style>';

Render the output:

$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out  = new QRCode($options)->render($data); // -> data:image/svg+xml;base64,PD94bWwgdmVyc2...

printf('<img alt="%s" src="%s" />', $alt, $out);

Additional methods

method return description
(protected) getCssClass(int $M_TYPE = 0) string returns a string with all css classes for the current element
(protected) getViewBox() string returns the value for the SVG viewBox attribute
(protected) header() string returns the <svg> header with the given options parsed
(protected) path(string $path, int $M_TYPE) string renders and returns a single <path> element
(protected) paths() string returns one or more SVG <path> elements
(protected) module(int $x, int $y, int $M_TYPE) string returns a path segment for a single module

Options that affect this class

property type
$circleRadius float
$connectPaths bool
$cssClass string
$drawCircularModules bool
$drawLightModules bool
$eol string
$excludeFromConnect array
$keepAsSquare array
$outputBase64 bool
$svgAddXmlHeader bool
$svgDefs string
$svgOpacity float
$svgPreserveAspectRatio string
$svgViewBoxSize int|null
$svgUseFillAttributes bool
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport