⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.
Symfony bundle to generate PNG QR codes as data URIs, with optional URL validation (http/https only) and host allowlisting.
Used by WalletQrBundle for wallet save-link QRs, and usable standalone in any Symfony app.
This bundle is FrankenPHP worker mode friendly.
make -C demo/symfony8 up
# http://localhost:8012/demoSee docs/DEMO-FRANKENPHP.md (FRANKENPHP_MODE=worker default; PHP 8.5 + gd).
- ✅ PNG QR codes as data URIs (
QrCodeService/QrCodeDataUriRenderer) - ✅ Named profiles (
default_profile+profiles) for size, ECC, and allowlists - ✅ Optional Doctrine storage: DB profiles override YAML by name (
use_database_config) - ✅ Admin CRUD at
/admin/qr-code-profiles(when DB storage is enabled) - ✅ URL safety policy (
QrUrlPolicy; blocksjavascript:,data:, etc.) - ✅ Optional host/URL allowlist (exact host or subdomain; path substrings;
#regex) - ✅ Typed
QrErrorCorrectionenum (low|medium|quartile|high) - ✅ Twig helpers
qr_code_data_uriandqr_code_for_url(optional profile argument) - ✅ Twig UX component
<twig:NowoQrCode>(symfony/ux-twig-component) - ✅ Compatible with Symfony UX Toolkit (optional host dependency, PHP 8.4+)
- ✅ Symfony configuration under
nowo_qr_code
composer require nowo-tech/qr-code-bundleRequires PHP gd (or another writer backend supported by endroid/qr-code).
# config/packages/nowo_qr_code.yaml
nowo_qr_code:
default_profile: default
profiles:
default:
size: 300
margin: 10
error_correction: high
url_allowlist: []
compact:
size: 128
margin: 2
error_correction: medium
url_allowlist:
- example.comuse Nowo\QrCodeBundle\Service\QrCodeService;
$dataUri = $qrCodeService->createDataUri('https://example.com');
$safeUri = $qrCodeService->createDataUriForUrl('https://example.com/path', 'compact');<img src="{{ qr_code_data_uri('Hello') }}" alt="QR">
<img src="{{ qr_code_for_url(downloadUrl, 'compact') }}" alt="QR">
<twig:NowoQrCode content="Hello" class="qr" />
<twig:NowoQrCode url="{{ downloadUrl }}" profile="compact" />- WalletQrBundle — Google Wallet / Apple Wallet save links + QR (depends on this bundle)
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
| Stack | Coverage | How to run |
|---|---|---|
| PHP | 100% lines (src/) |
make test-coverage / composer test-coverage |
| TypeScript / JavaScript | N/A (no frontend assets) | — |
| Python | N/A | — |
CI enforces PHP coverage at 100% (Clover elements / line gate via .scripts/coverage-check-100.php).
MIT © Nowo.tech
