endroid/qr-code
64.1
Adequate · 17 November 2026
2.2k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Add hex color getter to Color class
The Color class now includes a getHex() method that returns the color as a hexadecimal string (e.g., '\#RRGGBB'), complementing the existing RGB and alpha accessors. This allows users to easily obtain a standard hex representation of QR code colors for use in HTML, CSS, or other systems that expect hex color codes.
src/Color · high confidence
Introduce new Label component with font, margin, and alignment support
This change adds a new Label component to the library, allowing users to attach text labels to QR codes. The implementation includes a \Label\ class that supports configurable text, font (via \FontInterface\ with a default OpenSans font), alignment (center, left, right), margin (top, right, bottom, left), and text color. The component is structured with dedicated interfaces and classes for fonts and margins, providing a flexible API for customizing label appearance.
src/Label · high confidence
New Builder API for QR code generation
The src/Builder directory introduces a new Builder API, including the Builder class, BuilderInterface, BuilderRegistry, and BuilderRegistryInterface. This provides a structured way to configure and generate QR codes with options for data, encoding, error correction, size, colors, labels, and logos, along with a registry for managing multiple builder instances.
src/Builder · high confidence
New exception classes for block size and validation errors
The library now includes two new exception classes to provide more specific error handling: BlockSizeTooSmallException is introduced to signal when a QR code block size is insufficient, and ValidationException is added with factory methods to report issues such as unsupported writers, missing validation packages, or data mismatches during result verification.
src/Exception · high confidence
New label and logo image data classes with improved error handling
The src/ImageData directory now includes LabelImageData and LogoImageData classes to manage image data for labels and logos. LabelImageData validates that label text does not contain line breaks and ensures the FreeType extension is available. LogoImageData handles logo image loading, including support for SVG logos (which require explicit width and height), automatic MIME type detection from URLs or file paths, and a new punchout background feature. It also provides robust error handling for file reading, image parsing, and MIME type detection, ensuring clearer error messages when issues occur.
src/ImageData · high confidence
New logo support and expanded writer capabilities
The Writer module now supports embedding logos into QR codes via a new Logo model and LogoInterface, with background punchout functionality available for GD-based formats (PNG, GIF, WebP) and basic embedding for PDF and SVG (punchout is explicitly unsupported in SVG). Several writers have been updated or added: the SVG writer now supports compact path generation, block definitions, and options to exclude XML declarations or width/height attributes; the PDF writer adds support for embedding logos and clickable links; the PNG writer introduces compression level and color count options; and new writers for Binary, Console, Debug, and EPS outputs have been introduced to broaden output formats.
src/Writer · high confidence
New result classes for console, binary, debug, EPS, and PDF output formats
The library now provides dedicated result classes to render QR codes as plain text for terminal consoles (ConsoleResult), raw binary strings (BinaryResult), structured debug information (DebugResult), Encapsulated PostScript (EpsResult), and PDF documents (PdfResult). These additions expand the available output formats beyond the existing image-based results, allowing users to print QR codes directly to the command line, export vector graphics, or generate printable PDF files.
src/Writer/Result · high confidence
Behavioural changes
Introduces new immutable QrCode model and configuration enums
The library now uses a new, immutable \QrCode\ value object (implementing \QrCodeInterface\) to represent QR code data, replacing the previous mutable builder pattern. This model is configured via new enums: \ErrorCorrectionLevel\ (with cases High, Low, Medium, Quartile) and \RoundBlockSizeMode\ (with cases Enlarge, Margin, None, Shrink). Users must now construct QR codes using this new class constructor, which accepts parameters for data, encoding, error correction level, size, margin, round block size mode, and foreground/background colors.
src · high confidence
New Matrix class throws exception when block size is too small
The new Matrix class now validates that the calculated block size is at least 1 during construction. If the QR code data is too large for the given dimensions or error correction level, resulting in a block size smaller than 1, a BlockSizeTooSmallException is thrown with a message suggesting the user increase image dimensions or lower the error correction level.
src/Matrix · high confidence
Strict encoding validation with mbstring requirement for non-UTF-8
The Encoding component now enforces strict validation when a non-UTF-8 encoding is specified. If the mbstring extension is not installed, the system throws an exception immediately. If mbstring is present but the requested encoding is not in the list of supported encodings, a specific error is raised listing valid options. This ensures that only valid, supported encodings are used, preventing silent failures or undefined behavior in QR code generation.
src/Encoding · high confidence
Test coverage
Added comprehensive test suite for QR code generation and validation
Added new test files (BuilderTest, QrCodeTest, ValidatorTest) and test assets to verify the QR code library's functionality. The tests cover the new Builder API, ensuring correct output for various writers (PNG, SVG, WebP, GIF, PDF, EPS, Binary, Console, Debug) and result types. They also validate specific behaviors such as size and margin calculations with rounded block modes, error handling for invalid logo paths and data, file saving capabilities, label line break restrictions, and block size constraints. Additionally, the ValidatorTest ensures that generated QR codes are readable across diverse data inputs, including special characters, URLs, and non-Latin scripts.
tests · high confidence
Dependencies
Initial release of Endroid QR Code library
This change introduces the initial composer.json for the Endroid QR Code library, establishing it as a PHP library requiring PHP 8.4 and the bacon/bacon-qr-code package (version 3.0). It configures PSR-4 autoloading for the src/ and tests/ directories, sets up development dependencies including the GD extension, quality tools, and optional readers/writers (khanamiryan/qrcode-detector-decoder and setasign/fpdf), and defines a branch alias for the 6.x development line.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 63.3 → 64.1 (+0.8)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 70.7 → 65.4 (-5.3)
- Architecture 99.2 → 97.7 (-1.5)
- Maturity 55.4 → 59.1 (+3.7)
- Readiness 58.2 → 58.2 (0.0)
- Security 94.7 → 94.7 (0.0)
New (2)
- Off the main sequence: src/Exception
- Unstable project src/Writer
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
endroid/qr-code was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit b2be4d6111c3da2ca37aa8583f7b3f5ce1f0b7c0 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.