chillerlan/php-qrcode
A QR Code generator and reader with a user-friendly API. PHP 8.2+
6.0.1
43M downloads/mo
#320 most downloaded on Packagist
chillerlan/php-qrcode
What this package is like to depend on
Last release 5 months ago
18 Mar 2026
Ships fairly regularly
a new release about every 8 months
Rarely documented
notes for 10 of 45 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
45 releases · first in 2017
4 releases in the last 12 months
see the full history below
Release timeline
45 releases · Dec 2017 to Mar 2026Releases
latest 45-
6.0.118 Mar 2026Release notes
Open source →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.
TheQRMatrixclass 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::$bufferBitBuffer::getLength()BitBuffer::$lengthDetector::getFinderPatterns()Detector::$finderPatternsEccLevel::getLevel()EccLevel::$levelECICharset::getID()ECICharset::$charsetIDFinderPattern::getCount()FinderPattern::$countGenericGFPoly::getCoefficients()GenericGFPoly::$coefficientsLuminanceSourceInterface::getHeight()LuminanceSourceInterface::$heightLuminanceSourceInterface::getWidth()LuminanceSourceInterface::$widthLuminanceSourceInterface::getLuminances()LuminanceSourceInterface::$luminancesMaskPattern::getPattern()MaskPattern::$currentPatternQRData::getBitBuffer()QRData::$bitBufferQRMatrix::getEccLevel()QRMatrix::$eccLevelQRMatrix::getMaskPattern()QRMatrix::$maskPatternQRMatrix::getMatrix()QRMatrix::$matrixQRMatrix::getSize()QRMatrix::$moduleCountQRMatrix::getVersion()QRMatrix::$versionResultPoint::getEstimatedModuleSize()ResultPoint::$estimatedModuleSizeResultPoint::getX()ResultPoint::$xResultPoint::getY()ResultPoint::$yVersion::getVersionNumber()Version::$versionNumberThe following properties as well as the method
copyVars()inQROutputAbstractwill be removed in v7 without replacement,
as they only existed to improve performance by circumventing the magic getters in theQROptionsclass - 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::$circleRadiusThese changes are already in
dev-main. -
6.0.014 Mar 2026Release notes
Open source →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
mainbranch will remain the active development branch towards v7. If you have used the composer versiondev-mainwithout 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
QRCodeconstructor now also accepts aniterableas options, which is handed over to a newQROptionsinstance internally. - Extracted
QRMatrix::getBooleanMatrix()fromQRMatrix::getMatrix()to remove type ambiguity, the optional parameter$booleanhas been removed. - Added PHPBench to run benchmarks (the results can be found in the
benchmarkbranch). - Several bugfixes, cleanup, dependency updates, documentation update and examples.
- Settings (
QROptionsTrait)- [breaking] The property
QROptions::$outputTypeand the related constants inQROutputInterfacehave been removed. The output type is now specified viaQROptions::$outputInterfacewith the default value ofQRMarkupSVG::class. (#223). - Split QR Code reader options into separate
QRCodeReaderOptionsTrait. - The magic setter for
QROptions::$eccLevelnow also accepts the string valuesL, 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.
- [breaking] The property
- Output (
QROutputInterfaceand child classes)- [breaking] The parameter
$transformof the methodQROutputAbstract::collectModules(Closure $transform)has been removed in favor of a methodQROutputAbstract::moduleTransform():mixed|nullwhich is called with the same parameters. - Added
QRInterventionImage(intervention/image) output. - Added XML output
QRMarkupXMLincluding an XSD schemaqrcode.schema.xsd. - [possibly breaking]
QRStringJSONoverhaul, similar to XML output, including a JSON schemaqrcode.schema.json. - The GD output class now also supports the avif format via
QRGdImageAVIF. QRFpdf::dump(): allow using externalFPDFinstance.- Extracted
CssColorModuleValueTraitandRGBArrayModuleValueTraitfor use in custom output classes.
- [breaking] The parameter
- General
-
5.0.523 Nov 2025Release notes
Open source →- PHP 8.5 support (
imagedestroy()deprecation) - The parameter
$transformof the methodQROutputAbstract::collectModules(Closure $transform)has been deprecated in favor of the newly introduced methodQROutputAbstract::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
- PHP 8.5 support (
-
5.0.419 Sep 2025 -
5.0.321 Nov 2024Release notes
Open source →- 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
FPDFinstance as second optional parameter - dependency & CI updates
- fixed the broken PHPCS config
- added Slevomat Coding Standard
- added PHP Compatibility Coding Standard
- added PHPStorm code style
-
5.0.227 Feb 2024Release notes
Open source →- 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.
-
5.0.107 Jan 2024Release notes
Open source →ReedSolomonDecodernow throws aQRCodeDecoderExceptioninstead of the genericQRCodeException- added a
.gitattributesfile (#234) - minor performance (
QRMatrix) and type safety (MaskPattern) improvements - branch adjustments
- dependency updates
- test cleanup and improvements
-
5.0.024 Nov 2023Release notes
Open source →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 usingdev-mainand thev5-betainstead - 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
mainbranch will become (or rather remain) the active development branch towards v6. If you have used the composer versiondev-mainwithout 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!
New Features
- QR Code reader based on a PHP port of the ZXing library
- MIT and Apache 2.0 dual licensing to accommodate the ZXing related files, see: NOTICE
- Proper mixed mode support (several data mode segments can appear in the same QR symbol)
- Simplified Chinese (Hanzi/GB2312) support according to GBT18284-2000
- ECI mode support
Structured append mode(not yet...)
- Full "reversed reflectance" support (inverted matrix colors)
- Encapsulated Postscript (EPS) output
- An all new documentation at https://php-qrcode.readthedocs.io/en/v5.0.x/ in favor over the wiki
- A truckload of new examples
Changes
- [breaking] The default output has been changed from PNG (GdImage) to SVG. No image processing extension (
ext-gdorext-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
srcinto an<img>tag. This can be disabled by settingQROptions::$outputBase64tofalse. - [breaking] The default value of
QROptions::$imageTransparenthas been set tofalsedue 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 theQROptions::$moduleValuesarray have changed.QRMatrix::M_*_DARKconstants 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
QRMarkuphas been changed toabstract, inheritors are nowQRMarkupHTMLandQRMarkupSVG(QRMarkupXMLanyone?). - [possibly breaking] The
fill-opacityattribute (and its respective settingQROptions::$svgOpacity) has been removed fromQRMarkupSVG::path()as it can be set by CSS. - [possibly breaking] The
QROptions::$markupDarkandQROptions::$markupLightsettings have been removed - they can be set via overridingQRMarkup::getDefaultModuleValue(). - [possibly breaking] The
QROptions::$textDarkandQROptions::$textLightsettings have been removed - they can be set via overridingQRString::getDefaultModuleValue(). - The module value validation method
QROutputInterface::moduleValueIsValid()is nowpublic 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::$jpegQualityandQROptions::$pngCompressionhave been deprecated in favor of the more genericQROptions::$quality. - The setting
QROptions::$svgUseFillAttributeshas been added to togglefillattributes on the SVG<path>elements inQRMarkupSVG::path()(this was previously done via settingQROptions::$markupDarkandQROptions::$markupLightto an empty value).
- QR Code reader based on a PHP port of the ZXing library
-
4.4.215 Nov 2024Release notes
Open source →- PHP 8.4 support (implicit nullable types are deprecated)
- dependency & CI updates
-
4.4.106 Jan 2024 -
4.4.023 Nov 2023Nothing published for this version
-
4.3.425 Jul 2022Nothing published for this version
-
4.3.325 Nov 2021Nothing published for this version
-
4.3.218 Nov 2021Nothing published for this version
-
4.3.105 Jan 2021Nothing published for this version
-
4.3.018 Nov 2020Nothing published for this version
-
4.2.007 Oct 2020Nothing published for this version
-
4.1.004 Jun 2020Nothing published for this version
-
4.0.112 Apr 2020Nothing published for this version
-
4.0.006 Apr 2020Nothing published for this version
-
3.4.103 Sep 2021Nothing published for this version
-
3.4.018 Nov 2020Nothing published for this version
-
3.3.004 Jun 2020Nothing published for this version
-
3.2.312 Apr 2020Nothing published for this version
-
3.2.205 Apr 2020Nothing published for this version
-
3.2.119 Feb 2020Nothing published for this version
-
3.2.004 Dec 2019Nothing published for this version
-
3.1.109 Aug 2019Nothing published for this version
-
3.1.019 Apr 2019Nothing published for this version
-
3.0.320 Dec 2018Nothing published for this version
-
3.0.210 Nov 2018Nothing published for this version
-
3.0.101 Oct 2018Nothing published for this version
-
3.0.019 Sep 2018Nothing published for this version
-
2.0.812 Apr 2020Nothing published for this version
-
2.0.705 Apr 2020Nothing published for this version
-
2.0.628 Mar 2018Nothing published for this version
-
2.0.521 Mar 2018Nothing published for this version
-
2.0.410 Mar 2018Nothing published for this version
-
2.0.323 Jan 2018Nothing published for this version
-
2.0.221 Jan 2018Nothing published for this version
-
2.0.129 Dec 2017Nothing published for this version
-
2.0.024 Dec 2017Nothing published for this version
-
1.0.912 Apr 2020Nothing published for this version
-
1.0.819 Jan 2018Nothing published for this version
-
5.0-beta22 Mar 2023Nothing published for this version