Skip to content

[FEATURE] Data,Refinery: add QR code support#11391

Open
thibsy wants to merge 2 commits intoILIAS-eLearning:trunkfrom
srsolutionsag:feature/12/data-qr-code
Open

[FEATURE] Data,Refinery: add QR code support#11391
thibsy wants to merge 2 commits intoILIAS-eLearning:trunkfrom
srsolutionsag:feature/12/data-qr-code

Conversation

@thibsy
Copy link
Copy Markdown
Contributor

@thibsy thibsy commented Apr 2, 2026

Hi @mjansenDatabay,

This is the first iteration of my QR code abstraction for ILIAS, which I plan on using inside the UI framework to convert ILIAS\Data\URI objects into a QR code which can be embedded inline as a data URI.

I haven't worked out the exact details of the UI interface yet, so there may be changes in the meantime, but I'd still like to hear your 5 cents about this – it doesn't need to be an in-depth code review just yet. I will also wait with the JF label until you have approved of the details, although I will post the formal request in here some time soon already.

What I have worked out:

  • I have evaluated different QR code generation libraries, the one used here is the most low-level and widely used one, but details will come soon. Important to note is that all of them require two settings in addition to the string data which should be encoded: the error correction level and some kind of size, which is not always the same though (size in px vs. size for byte-map). Replacing the library would be very easy, since they all seem to mimic the ZXing library for Java.
  • I have determined that an SVG is the most suitable output format, since we do not create temporary files (although an underlying library might do so, but this one doesn't) and can always work with strings and in memory. It also allows us to easily embed this as a data URI. It also still allows us to create and store the QR code as files ourselves later on.
  • I also figured we need some DTO carrying the actual SVG data so it can be passed around between layers, in addition to some transformation that serves as the actual wrapper for the external library. Similar has been done for the markdown syntax.

What I haven't worked out (yet):

  • I am not yet sure how the accessibility of QR codes can be ensured and implemented centrally. I think Data and Refinery are not the most appropriate location to do so, since making the QR code accessible seems responsibility of the UI layer – be that the UI framework or not. That's why I did not introduce the "raw data" or some kind of "alternate text" attribute to the DTO, although I might change this in the future.
  • I was also kind of confused where to put the newly added objects (namespace and location), I figured for Data a new namespace made sense and for Refinery the String location is right. Let me know if you feel differently.
  • I would have liked to use DI for the new transformation inside the Refinery. However, this isn't done anywhere else and I wondered whether this is deliberately or not. Not doing so obviously makes the added unit tests highly dependant on the actual implementation details of the library in use. Let me know if I should wire this feature using the bootstrap mechanism.

Looking forward to your thoughts.

Thx and kind regards,
@thibsy

@thibsy thibsy added improvement dependencies Pull requests that update a dependency file php Pull requests that update Php code labels Apr 2, 2026
@thibsy thibsy force-pushed the feature/12/data-qr-code branch from 613b2fe to 3de0fa2 Compare April 2, 2026 13:24
* Add `ILIAS\Data\QR\SVGCode` wrapper for generated QR codes.
* Add `ILIAS\Data\QR\ErrorCorrectionLevel` for standardised error correction levels.
* Add `ILIAS\Refinery\String\QRCode` transformation to convert string into a QR code.
* Add unit tests covering the functionality above.
@thibsy thibsy force-pushed the feature/12/data-qr-code branch from 3de0fa2 to 0e88c35 Compare April 2, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file improvement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants