Download the PHP package qrid/codec without Composer
On this page you can find all versions of the php package qrid/codec. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package codec
qrid/codec — PHP
PHP library for encoding and decoding MergeID electronic invoice QR codes.
MergeID QR codes embed invoice identity information (company, tax ID, contact, address) as a base64-encoded JSON payload. This library handles the encode/decode round-trip and, optionally, SVG QR image generation.
Typical usage flow
Installation
Usage
Decode
Pass the raw string value scanned from a QR code:
decodeQRId trims surrounding whitespace from the input before decoding, so strings
copied with accidental padding are handled transparently.
Exceptions thrown:
| Exception | Cause |
|---|---|
InvalidArgumentException |
Input is not valid base64 |
JsonException |
Decoded bytes are not valid JSON |
Encode (requires chillerlan/php-qrcode)
Produce an SVG QR code from invoice identity fields:
activityCode is optional and defaults to '' (blank). A blank activity code signals a
consuming system to generate an electronic ticket instead of using an activity code.
Exceptions thrown:
| Exception | Cause |
|---|---|
RuntimeException |
chillerlan/php-qrcode is not installed |
JsonException |
JSON encoding of the payload failed (should not occur in practice) |
Payload format
The QR code data is a UTF-8 JSON object encoded as standard base64 (no line-breaks):
| Field | Type | Description |
|---|---|---|
v |
int |
Payload schema version. Currently always 1. |
id |
string |
Tax / company registration ID. |
company |
string |
Legal company name (UTF-8, including accented characters). |
email |
string |
Primary billing or contact e-mail address. |
address |
string |
Physical address of the company. |
activity_code |
string |
Installation or activity code that links the QR to an internal record. May be blank (""), which signals a consuming system to generate an electronic ticket instead. |
Requirements
| Dependency | Version | Required for |
|---|---|---|
| PHP | >= 8.1 |
Always |
chillerlan/php-qrcode |
^5.0 |
encodeQRId() only |
Running tests
Tests cover field decoding, UTF-8 handling, whitespace trimming, error paths, and (when chillerlan/php-qrcode is available) the full encode-decode round-trip.
Publishing
New versions reach Packagist automatically — there is no build/upload step:
- Bump the version in the
VERSIONfile (repo root) and merge tomain. release.ymlruns on every push tomain. It readsVERSION; if novX.Y.Ztag already exists for it, it runs PHPUnit across PHP 8.2–8.4 (PHPUnit 11's minimum, even though the library itself supports PHP >= 8.1) and creates that tag plus a GitHub Release.- Packagist's webhook on this repository picks up the new tag and republishes it within moments. Composer installs straight from the tagged GitHub source (via
dist/zipball), so — unlike PyPI or npm — there's no artifact to build/upload and no OIDC/trusted-publisher concept to configure.
composer.json intentionally has no version field: Composer/Packagist derive the version purely from git tags, and a hardcoded field risks drifting out of sync with the actual tag. VERSION exists only so the release workflow has something to read.
Pushes to main that don't change VERSION are a no-op (the tag already exists), so unrelated commits (docs, CI tweaks) don't trigger a release.
License
MIT