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

QRGdImage

Class QRGdImage: GdImage raster graphic output (GIF, JPG, PNG, ...)

Example

See: GdImage example

Set the options:

$options = new QROptions;

// $outputInterface can be one of the classes listed in `QROutputInterface::MODES`
$options->outputInterface     = QRGdImageWEBP::class;
$options->quality             = 90;
// the size of one qr module in pixels
$options->scale               = 20;
$options->bgColor             = [200, 150, 200];
$options->imageTransparent    = true;
// the color that will be set transparent
// [@see](https://github.com/see) https://www.php.net/manual/en/function.imagecolortransparent
$options->transparencyColor   = [200, 150, 200];
$options->drawCircularModules = true;
$options->drawLightModules    = true;
$options->circleRadius        = 0.4;
$options->keepAsSquare        = [
	QRMatrix::M_FINDER_DARK,
	QRMatrix::M_FINDER_DOT,
	QRMatrix::M_ALIGNMENT_DARK,
];
$options->moduleValues        = [
	QRMatrix::M_FINDER_DARK    => [0, 63, 255], // dark (true)
	QRMatrix::M_FINDER_DOT     => [0, 63, 255], // finder dot, dark (true)
	QRMatrix::M_FINDER         => [233, 233, 233], // light (false)
	QRMatrix::M_ALIGNMENT_DARK => [255, 0, 255],
	QRMatrix::M_ALIGNMENT      => [233, 233, 233],
	QRMatrix::M_DATA_DARK      => [0, 0, 0],
	QRMatrix::M_DATA           => [233, 233, 233],
];

Render the output:

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

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

Return the GdImage instance (will ignore other output options):

$options->returnResource = true;

/** [@var](https://github.com/var) \GdImage $gdImage */
$gdImage = new QRCode($options)->render($data);

// do stuff with the GdImage instance...
$size = imagesx($gdImage);
// ...

// ...dump output
header('Content-type: image/jpeg');

imagejpeg($gdImage);
imagedestroy($gdImage);

Additional methods

method return description
(protected) drawImage() void Draws the QR image
(protected) dumpImage() string Creates the final image by calling the desired GD output function
(protected) module(int $x, int $y, int $M_TYPE) void Renders a single module
(protected) setBgColor() void Sets the background color
(protected) setTransparencyColor() void Sets the transparency color
(abstract protected) renderImage() void Renders the image with the gdimage function for the desired output, implemented by child classes

Options that affect this class

property type
$bgColor mixed
$circleRadius float
$drawCircularModules bool
$drawLightModules bool
$imageTransparent bool
$quality int
$keepAsSquare array
$outputBase64 bool
$returnResource bool
$scale int
$transparencyColor mixed
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