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
6.0.1

The following methods (property getters) have been deprecated in favor of asymmetric visibility, which is available as of PHP 8.4 and which is the minimum requirement of the next major version (v7) of php-qrcode. The QRMatrix class will see an addition of a magic getter that emulates the future behaviour as an upgrade path, the other methods are only used internally and will see no such addition for the time being.

method replacement
BitBuffer::getBuffer() BitBuffer::$buffer
BitBuffer::getLength() BitBuffer::$length
Detector::getFinderPatterns() Detector::$finderPatterns
EccLevel::getLevel() EccLevel::$level
ECICharset::getID() ECICharset::$charsetID
FinderPattern::getCount() FinderPattern::$count
GenericGFPoly::getCoefficients() GenericGFPoly::$coefficients
LuminanceSourceInterface::getHeight() LuminanceSourceInterface::$height
LuminanceSourceInterface::getWidth() LuminanceSourceInterface::$width
LuminanceSourceInterface::getLuminances() LuminanceSourceInterface::$luminances
MaskPattern::getPattern() MaskPattern::$currentPattern
QRData::getBitBuffer() QRData::$bitBuffer
QRMatrix::getEccLevel() QRMatrix::$eccLevel
QRMatrix::getMaskPattern() QRMatrix::$maskPattern
QRMatrix::getMatrix() QRMatrix::$matrix
QRMatrix::getSize() QRMatrix::$moduleCount
QRMatrix::getVersion() QRMatrix::$version
ResultPoint::getEstimatedModuleSize() ResultPoint::$estimatedModuleSize
ResultPoint::getX() ResultPoint::$x
ResultPoint::getY() ResultPoint::$y
Version::getVersionNumber() Version::$versionNumber

The following properties as well as the method copyVars() in QROutputAbstract will be removed in v7 without replacement, as they only existed to improve performance by circumventing the magic getters in the QROptions class - these are replaced by (set) property hooks where unnecessary overhead is reduced. Some of the built-in output classes may see the re-addition of some of these properties locally, depending on the performance impact.

QROutputAbstract::$excludeFromConnect
QROutputAbstract::$keepAsSquare
QROutputAbstract::$connectPaths
QROutputAbstract::$eol
QROutputAbstract::$drawCircularModules
QROutputAbstract::$drawLightModules
QROutputAbstract::$circleRadius

These changes are already in dev-main.

6.0.0

Hi, I've kept you waiting for too long now, so I'm going to release it "as is". Originally I planned to add support for creating Structured Append QR Codes but I'm currently lacking the mental capacity to wrap my head around this concept (a method to calculate the parity already exists in the code, feel free to submit a PR!).

Once again, a big thank you to everyone who submitted issue reports and opened discussions and helped to improve this library!

IMPORTANT: v6 will be branched out and the main branch will remain the active development branch towards v7. If you have used the composer version dev-main without a commit hash in the past, please make sure to update the requirement ASAP. You have been warned.

For feedback and questions please head over to the linked discussion!

Changelog

  • General
    • The required minimum PHP version is now 8.2.
    • The QRCode constructor now also accepts an iterable as options, which is handed over to a new QROptions instance internally.
    • Extracted QRMatrix::getBooleanMatrix() from QRMatrix::getMatrix() to remove type ambiguity, the optional parameter $boolean has been removed.
    • Added PHPBench to run benchmarks (the results can be found in the benchmark branch).
    • Several bugfixes, cleanup, dependency updates, documentation update and examples.
  • Settings (QROptionsTrait)
    • [breaking] The property QROptions::$outputType and the related constants in QROutputInterface have been removed. The output type is now specified via QROptions::$outputInterface with the default value of QRMarkupSVG::class. (#223).
    • Split QR Code reader options into separate QRCodeReaderOptionsTrait.
    • The magic setter for QROptions::$eccLevel now also accepts the string values L, M, Q, H (case-insensitive) - these will be converted internally to the respective integers. (#160).
    • The property QROptions::$scale (module scaling for several raster image output classes) is now clamped between 1 and 50.
  • Output (QROutputInterface and child classes)
    • [breaking] The parameter $transform of the method QROutputAbstract::collectModules(Closure $transform) has been removed in favor of a method QROutputAbstract::moduleTransform():mixed|null which is called with the same parameters.
    • Added QRInterventionImage (intervention/image) output.
    • Added XML output QRMarkupXML including an XSD schema qrcode.schema.xsd.
    • [possibly breaking] QRStringJSON overhaul, similar to XML output, including a JSON schema qrcode.schema.json.
    • The GD output class now also supports the avif format via QRGdImageAVIF.
    • QRFpdf::dump(): allow using external FPDF instance.
    • Extracted CssColorModuleValueTrait and RGBArrayModuleValueTrait for use in custom output classes.
5.0.5
  • PHP 8.5 support (imagedestroy() deprecation)
  • The parameter $transform of the method QROutputAbstract::collectModules(Closure $transform) has been deprecated in favor of the newly introduced method QROutputAbstract::moduleTransform() with the same parameters as the anonymous closure. The parameter will be removed in v6.
  • Remaining instances of empty() have been replaced with more precise checks.
  • dependency & CI updates
5.0.4
  • hand over finder pattern coordinates to the decoder result (#248)
  • fixed a bug in the AlphaNum string validator and added additional tests (#313)
  • dependency updates
5.0.3
  • PHP 8.4 support (implicit nullable types are deprecated) (#276)
  • ECI decoding now allows for numeric and alphanumeric segments to be preceded by an ECI designator (#289)
  • simplified Number and AlphaNum classes (backport from dev-main. v6)
  • QRFpdf::dump() now accepts an FPDF instance as second optional parameter
  • dependency & CI updates
  • added PHPStorm code style
4.4.2
  • PHP 8.4 support (implicit nullable types are deprecated)
  • dependency & CI updates
5.0.2
  • fixed a bug in the QR Code version auto detection when the given data segment was the exact same bit size as the maximum for the guessed provisional version, added a safety margin of 4 bits, which forces the next available version in that case.
4.4.1
  • added a .gitattributes file (#234)
  • dependency updates
5.0.1
  • ReedSolomonDecoder now throws a QRCodeDecoderException instead of the generic QRCodeException
  • added a .gitattributes file (#234)
  • minor performance (QRMatrix) and type safety (MaskPattern) improvements
  • branch adjustments
  • dependency updates
  • test cleanup and improvements
5.0.0

Hi! It's been a while since the last major version - has it already been over three years and seven million downloads??? Time flies... v5 was supposed to be released earlier this year already, but various health issues kept me from working on it and I kept y'all waiting and using dev-main and the v5-beta instead - but hey, the wait is over now!

The new version comes with countless internal changes, mostly to incooperate the ZXing QR Code reader and open the possibility for other types of barcodes, such as micro QR. A lot of things have been deprecated and moved in order to clean up for v6 which is intended to support PHP 8.2+ (or maybe 8.3+ even). See the attached discussion thread for a full list of changes and deprecations.

IMPORTANT: v5 will be branched out and the main branch will become (or rather remain) the active development branch towards v6. If you have used the composer version dev-main without a commit hash in the past, please make sure to update the requirement ASAP. You have been warned.

Also, a big thank you to everyone who submitted issue reports and opened discussions and helped to improve this library!

Ko-fi Paypal

New Features

Changes

  • [breaking] The default output has been changed from PNG (GdImage) to SVG. No image processing extension (ext-gd or ext-imagick) required anymore!
  • [breaking] The default output format of the built-in output classes is now a base64 data URI (if applicable) so that it can be directly embedded as src into an <img> tag. This can be disabled by setting QROptions::$outputBase64 to false.
  • [breaking] The default value of QROptions::$imageTransparent has been set to false due to various issues and misconceptions with transparency in GD and ImageMagick, therefore: use at your own risk.
  • [breaking] The values of the QRMatrix::M_* constants and therefore the keys of the QROptions::$moduleValues array have changed. QRMatrix::M_*_DARK constants have been introduced for convenience. The module values are now a proper bitmask, the dark value is now calculated (QRMatrix::M_* | QRMatrix::IS_DARK) instead of (QRMatrix::M_* << 8).
  • [breaking] The output class QRMarkup has been changed to abstract, inheritors are now QRMarkupHTML and QRMarkupSVG (QRMarkupXML anyone?).
  • [possibly breaking] The fill-opacity attribute (and its respective setting QROptions::$svgOpacity) has been removed from QRMarkupSVG::path() as it can be set by CSS.
  • [possibly breaking] The QROptions::$markupDark and QROptions::$markupLight settings have been removed - they can be set via overriding QRMarkup::getDefaultModuleValue().
  • [possibly breaking] The QROptions::$textDark and QROptions::$textLight settings have been removed - they can be set via overriding QRString::getDefaultModuleValue().
  • The module value validation method QROutputInterface::moduleValueIsValid() is now public static, so that input values can be checked before invoking the options, e.g. QRMarkupSVG::moduleValueIsValid('#aabbcc'). Please note that in case of HTML and SVG it will only check for the basic syntax, it will not validate or sanitize the values.
  • The GD output class now also supports BMP and WEBP output.
  • The formerly GD exclusive options QROptions::$jpegQuality and QROptions::$pngCompression have been deprecated in favor of the more generic QROptions::$quality.
  • The setting QROptions::$svgUseFillAttributes has been added to toggle fill attributes on the SVG <path> elements in QRMarkupSVG::path() (this was previously done via setting QROptions::$markupDark and QROptions::$markupLight to an empty value).
4.4.0

Maintenance release

This release serves as the final v4.x release and as an intermediate to v5 (unless something weird happens and I have to backport a bugfix or so...) - both versions support PHP 7.4+, so there's actually no reason to hold onto v4.x unless you're running extensive custom output classes, in which case this release is for you.

  • added QRMatrix::M_*_DARK constants for convenience (v5 backport). These constants should have been added way earlier as the current way to specify the QROptions:$moduleValues is highly unintuitive.
  • added PHPCS and PHPMD configurations as well as a .editorconfig
  • changed the values of QRMatrix::M_DARKMODULE and QRMatrix::M_FINDER_DOT to reflect their supposed dark values, QRMatrix::M_DARKMODULE_LIGHT and QRMatrix::M_FINDER_DOT_LIGHT have been added with the original values as placeholders for reflectance reversal. This change is backward incompatible, however, the worst that can happen is that the module values (if specified) will fall back to their internal defaults.
  • changed the default values of QROptions::$textDark and QROptions::$textLight from 🔴 and to ██ and ░░, respectively. (see here)
  • removed public and examples namespaces from autoload-dev
  • removed Scrutinizer CI in favour of Codacy
  • cleanup: all examples are now self-contained
  • dependency updates
  • CI updates
5.0-beta

It's here! The main public API is finished so far. What's left is some cleanup and documenting. Check out the release notes and feel free to leave feedback in the linked discussion thread. Thanks!

{
	"minimum-stability": "beta",
	"prefer-stable": true,
	"require": {
		"php": "^7.4 || ^8.0",
		"chillerlan/php-qrcode": "5.0-beta"
	}
}
4.3.4
4.3.3
  • fix PHP 8.1 deprecation warning for strtolower() (#97)
4.3.2

Service release:

  • CI fixes/updates
  • dependency updates
  • cleanup

v4.3.x will be branched out from here in favor of v5 on main.

3.4.1
  • PHP8 compatibility

This is a fire-and-forget release! Reminder that PHP 7.2 is already EOL and 7.3 is EOL by December 2021. Fix your composer.json requirements now!

4.3.1

Fixes:

  • don't auto adjust logo space if start values are given
  • disabled base64 output in the SVG example
  • CI updates & a bit cleanup

Note: this is the final 4.x release. (i don't know why the workflow run failed this time for v4 and i won't fix it - it didn't fail when it was committed...)

3.4.0

:sparkles: One Million Edition :sparkles:

New features:

  • support for logos: QRMatrix::setLogoSpace() (example), added constant QRMatrix::M_LOGO (#52)
  • allowed coloring the dot of the finder patterns individually via the new constant QRMatrix::M_FINDER_DOT (#52)
  • allowed returning the image resource (resource , GdImage, Imagick, FPDF) from QROutputInterface::dump() via QROptions::$returnResource
  • allowed returning base64 encoded data URIs for SVG and FPDF output
    • this change may break backwards compatibility for these output modes - to fix this, set QROptions::$imageBase64 to false.

Fixes & cleanup:

  • fixed a bug that could cause unexpected "code length overflow" exceptions for version 33 QR Codes
  • stopped tampering with mb_internal_encoding() as it had no effect here anyways
  • check for ext-gd and ext-imagick when initializing the respective output modules

(deleted & re-released as the previous 3.4.0 tag pointed to the 4.x branch. sorry for any inconvenience, i am dumb.)

4.3.0

:sparkles: One Million Edition :sparkles:

New features:

  • support for logos: QRMatrix::setLogoSpace() (example), added constant QRMatrix::M_LOGO (#52)
  • allowed coloring the dot of the finder patterns individually via the new constant QRMatrix::M_FINDER_DOT (#52)
  • allowed returning the image resource (resource , GdImage, Imagick, FPDF) from QROutputInterface::dump() via QROptions::$returnResource
  • allowed returning base64 encoded data URIs for SVG and FPDF output

Fixes & cleanup:

  • fixed a bug that could cause unexpected "code length overflow" exceptions for version 33 QR Codes
  • stopped tampering with mb_internal_encoding() as it had no effect here anyways
  • check for ext-gd and ext-imagick when initializing the respective output modules
  • migrated phpunit.xml to support the new format
  • moved CI completely to GH Actions via shivammathur/setup-php - sorry Travis! :(
  • moved documentation to the wiki
4.2.0
  • PHP8 support
4.1.0
  • Added PDF support via FPDF (#49)
3.3.0
  • Added PDF support via FPDF
  • Made ext-gd and ext-json optional (removed from composer.json). Please note that ext-gd is still necessary for the default output method that is png.
4.0.1
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 001, 010 and 100 were used (variables $x and $y were swapped) - see #45 for more information
  • improved mask pattern generation
3.2.3
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 001, 010 and 100 were used (variables $x and $y were swapped) - see #45 for more information
  • improved mask pattern generation
2.0.8
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 001, 010 and 100 were used (variables $x and $y were swapped) - see #45 for more information
  • improved mask pattern generation
1.0.9
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 001, 010 and 100 were used (variables $x and $y were swapped) - see #45 for more information
  • improved mask pattern generation
4.0.0
3.2.2
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 2 and 3 were used (variables $x and $y were flipped)
  • improved mask pattern generation
2.0.7
  • fixed a bug that could result in unreadable QR codes in case when mask pattern 2 and 3 were used (variables $x and $y were flipped)
  • improved mask pattern generation
3.2.1
  • dependency update (PHPUnit 8.5)
  • GH Actions updated for PHP 7.4
  • several docblock fixes
3.2.0
  • added an option QROptions::$dataMode to allow overriding the data type detection (see #39)
  • :sparkles: GitHub Actions CI
  • cleanup:tm:

The next major release will target PHP 7.4+!

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