A PHP QR Code generator and reader with a user-friendly API.
.gitattributes
file (#234)ReedSolomonDecoder
now throws a QRCodeDecoderException
instead of the generic QRCodeException
.gitattributes
file (#234)QRMatrix
) and type safety (MaskPattern
) improvementsHi! 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!
ext-gd
or ext-imagick
) required anymore!src
into an <img>
tag. This can be disabled by setting QROptions::$outputBase64
to false
.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.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)
.QRMarkup
has been changed to abstract
, inheritors are now QRMarkupHTML
and QRMarkupSVG
(QRMarkupXML
anyone?).fill-opacity
attribute (and its respective setting QROptions::$svgOpacity
) has been removed from QRMarkupSVG::path()
as it can be set by CSS.QROptions::$markupDark
and QROptions::$markupLight
settings have been removed - they can be set via overriding QRMarkup::getDefaultModuleValue()
.QROptions::$textDark
and QROptions::$textLight
settings have been removed - they can be set via overriding QRString::getDefaultModuleValue()
.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.QROptions::$jpegQuality
and QROptions::$pngCompression
have been deprecated in favor of the more generic QROptions::$quality
.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).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.
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..editorconfig
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.QROptions::$textDark
and QROptions::$textLight
from 🔴
and â•
to ██
and â–‘â–‘
, respectively. (see here)public
and examples
namespaces from autoload-dev
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"
}
}
QRCode::isByte()
: string "0
" fails with empty()chillerlan/php-settings-container: ^2.1.4
to fix a PHP 8.1 deprecation warning. See https://github.com/chillerlan/php-settings-container/discussions/2
strtolower()
(#97)Service release:
v4.3.x
will be branched out from here in favor of v5 on main.
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!