Open-source PHP libraryQR Code Generator
QR codes that look like your brand.
PHP library for custom QR codes: module shapes, corner markers, a center logo and output to SVG, PNG, JPEG or WebP.


- Year
- 2026
- Role
- Architecture, implementation, tests, documentation and demo page.
- Stack
- PHP 8.1+
- SVG
- GD
- PHPUnit
The problem
PHP QR code libraries handle encoding well but give little control over how the code looks. Anyone who needs an on-brand QR code ends up reaching for JavaScript tools or third-party services.
By the numbers
- 5built-in module shapes, plus custom ones
- 4output formats: SVG, PNG, JPEG and WebP
- 7layers, from encoding to validation
- 0JavaScript needed for styling
What was built
Encoding is delegated to bacon/bacon-qr-code; everything visual (layout, shapes, styling and rendering) lives in the library, in separate layers.
Square, circle, rounded, diamond and “classy rounded” shapes, the last one reading neighboring modules to draw continuous corners.
Custom shapes through a closure that returns an SVG path, with a readability validator.
Independent styling for corner markers, their centers and each module type.
A center logo with a reserved quiet area, rejecting sizes that would hurt scanning.
An SVG path optimizer, a fluent API, a factory and a sample CLI.
In practice
<?php
use Tonsoo\QrCode\Styling\ModuleStyle;
$svg = qrCode('https://alysson-thoaldo.com.br')
->size(640)
->margin(32)
->foreground('#0f766e')
->modules(ModuleStyle::classyRounded(1.0))
->toSvg();Screens

Online generator: every change is rendered by the library on the server.
Outcome
Produces server-side, in plain PHP, the kind of styled QR code that used to require JavaScript in the browser. Available on Packagist, with an online generator to try it.


