Configuration
Zero configuration is required. The published config/qr.php in full:
return [
'error_correction' => env('QR_ERROR_CORRECTION', 'M'),
'boost_error_correction' => env('QR_BOOST_ERROR_CORRECTION', true),
'versions' => ['min' => 1, 'max' => 40],
'mask' => null,
'eci' => env('QR_ECI', 'auto'),
'kanji' => false,
'svg' => [
'size' => 256,
'margin' => 4,
'foreground' => '#000000',
'background' => '#ffffff',
'module_style' => 'square',
'module_radius' => 0.5,
'finder_style' => 'square',
'finder_color' => null,
'xml_declaration' => false,
],
'response' => ['max_age' => 86400, 'immutable' => false],
'memo' => ['entries' => 64],
'cache' => [
'enabled' => env('QR_CACHE', false),
'store' => env('QR_CACHE_STORE'),
'ttl' => 86400,
'prefix' => 'qr',
],
'blade' => ['component' => 'qr-code'],
'payments' => [
'epc' => [
'version' => env('QR_EPC_VERSION', '002'),
'charset' => 'utf-8',
'strict_charset' => false,
],
'bysquare' => [
'version' => env('QR_BYSQUARE_VERSION', '1.2.0'),
'deburr' => env('QR_BYSQUARE_DEBURR', true),
],
],
];Every key
| Key | Default | Env | Purpose |
|---|---|---|---|
error_correction | M | QR_ERROR_CORRECTION | Default level: L (7 %), M (15 %), Q (25 %), H (30 %). |
boost_error_correction | true | QR_BOOST_ERROR_CORRECTION | Raise the level for free when the chosen version has room. Never changes the version. |
versions.min / versions.max | 1 / 40 | — | Allowed symbol versions (1–40, min ≤ max). |
mask | null | — | Force a mask 0–7; null picks the lowest ISO penalty. |
eci | auto | QR_ECI | ECI 26 (UTF-8) designator: auto (only for non-ASCII UTF-8), always, never. |
kanji | false | — | Allow Shift JIS kanji segments (never combined with an ECI designator). |
svg.size | 256 | — | Width/height in px (1–8192); null renders a responsive SVG (viewBox only). |
svg.margin | 4 | — | Quiet zone in modules (0–64). ISO/IEC 18004 asks for 4. |
svg.foreground / svg.background | #000000 / #ffffff | — | Hex, rgb()/rgba(), CSS named colours, currentColor; transparent omits the background. |
svg.module_style / svg.module_radius | square / 0.5 | — | square, rounded or dots; radius in modules (0 < r ≤ 0.5). |
svg.finder_style / svg.finder_color | square / null | — | square or rounded finder patterns; null colour = foreground. |
svg.xml_declaration | false | — | Prefix inline SVG with an XML declaration. Responses and downloads always include it. |
response.max_age / response.immutable | 86400 / false | — | Cache-Control for public and personal codes. |
memo.entries | 64 | — | In-process LRU of encoded matrices (public payloads only); 0 disables. |
cache.enabled | false | QR_CACHE | Cache rendered SVG of public payloads in a Laravel cache store. |
cache.store | null | QR_CACHE_STORE | Cache store to use; null or blank = the default store. |
cache.ttl / cache.prefix | 86400 / qr | — | Seconds a rendered SVG stays cached, and the cache key prefix. |
blade.component | qr-code | — | Component alias (<x-qr-code>); null or blank (not set) disables it. |
payments.epc.version | 002 | QR_EPC_VERSION | EPC069-12 version: 001 (BIC mandatory) or 002 (BIC optional for EEA IBANs). |
payments.epc.charset | utf-8 | — | utf-8, iso-8859-1, -2, -4, -5, -7, -10, -15. |
payments.epc.strict_charset | false | — | Restrict EPC text to the SEPA Latin subset. |
payments.bysquare.version | 1.2.0 | QR_BYSQUARE_VERSION | 1.0.0, 1.1.0 or 1.2.0 (beneficiary name mandatory). |
payments.bysquare.deburr | true | QR_BYSQUARE_DEBURR | Strip diacritics from the note and beneficiary fields. |
Keys are validated on read. A key that is not set — absent, null or blank ('' or whitespace, such as a QR_ECI= line in .env) — takes the default above; for mask, svg.size, svg.finder_color, cache.store and blade.component, not set is the same as null (so a blank svg.size renders a responsive SVG). A misconfigured key — a typo such as QR_ECI=sometimes — throws InvalidQrConfigException naming the key. error_correction also accepts the case names low, medium, quartile and high, in any case.
Environment
The most common switches are env-driven:
QR_ERROR_CORRECTION=M
QR_BOOST_ERROR_CORRECTION=true
QR_ECI=auto
QR_CACHE=true
QR_CACHE_STORE=redis
QR_EPC_VERSION=002
QR_BYSQUARE_VERSION=1.2.0
QR_BYSQUARE_DEBURR=trueInspecting the effective settings
php artisan about shows a Qr section with the effective settings — error correction and boost, versions, mask, ECI, kanji, SVG defaults, memo, cache, Blade component, EPC and PAY by square. It never prints the cache store’s name.
php artisan aboutShow your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.