qrid / codec
Decode and encode MergeID electronic invoice QR codes
v1.0.0
2026-05-27 13:12 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
- chillerlan/php-qrcode: ^5.0 — required for encodeQRId() SVG generation
This package is not auto-updated.
Last update: 2026-05-28 11:16:00 UTC
README
Decode and encode MergeID electronic invoice QR codes.
Installation
# Decode only (no extra dependencies) composer require qrid/codec # Decode + encode (add QR generation library) composer require qrid/codec chillerlan/php-qrcode
Usage
Decode
use QRId\Codec; // $encoded is the raw string value scanned from the QR code $payload = Codec::decodeQRId($encoded); echo $payload['code']; // Installation activity code echo $payload['id']; // User / installation ID echo $payload['company']; // Company legal name echo $payload['email']; // Email address echo $payload['address']; // Physical address
Encode (requires chillerlan/php-qrcode)
use QRId\Codec; $svg = Codec::encodeQRId( code: 'ACT-12345', id: '3101679980', company: 'Acme Corp S.A.', email: 'billing@acme.example', address: '123 Main St, San José, Costa Rica', ); // Output as SVG image header('Content-Type: image/svg+xml'); echo $svg;
Payload format
The QR code contains a UTF-8 JSON object encoded as standard base64:
{
"v": 1,
"code": "ACT-12345",
"id": "3101679980",
"company": "Acme Corp S.A.",
"email": "billing@acme.example",
"address": "123 Main St, San José, Costa Rica"
}
Requirements
- PHP 8.0+
chillerlan/php-qrcode^5.0 (only forencodeQRId)
License
MIT