NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
QR for Laravel

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

KeyDefaultEnvPurpose
error_correctionMQR_ERROR_CORRECTIONDefault level: L (7 %), M (15 %), Q (25 %), H (30 %).
boost_error_correctiontrueQR_BOOST_ERROR_CORRECTIONRaise the level for free when the chosen version has room. Never changes the version.
versions.min / versions.max1 / 40—Allowed symbol versions (1–40, min ≤ max).
masknull—Force a mask 0–7; null picks the lowest ISO penalty.
eciautoQR_ECIECI 26 (UTF-8) designator: auto (only for non-ASCII UTF-8), always, never.
kanjifalse—Allow Shift JIS kanji segments (never combined with an ECI designator).
svg.size256—Width/height in px (1–8192); null renders a responsive SVG (viewBox only).
svg.margin4—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_radiussquare / 0.5—square, rounded or dots; radius in modules (0 < r ≤ 0.5).
svg.finder_style / svg.finder_colorsquare / null—square or rounded finder patterns; null colour = foreground.
svg.xml_declarationfalse—Prefix inline SVG with an XML declaration. Responses and downloads always include it.
response.max_age / response.immutable86400 / false—Cache-Control for public and personal codes.
memo.entries64—In-process LRU of encoded matrices (public payloads only); 0 disables.
cache.enabledfalseQR_CACHECache rendered SVG of public payloads in a Laravel cache store.
cache.storenullQR_CACHE_STORECache store to use; null or blank = the default store.
cache.ttl / cache.prefix86400 / qr—Seconds a rendered SVG stays cached, and the cache key prefix.
blade.componentqr-code—Component alias (<x-qr-code>); null or blank (not set) disables it.
payments.epc.version002QR_EPC_VERSIONEPC069-12 version: 001 (BIC mandatory) or 002 (BIC optional for EEA IBANs).
payments.epc.charsetutf-8—utf-8, iso-8859-1, -2, -4, -5, -7, -10, -15.
payments.epc.strict_charsetfalse—Restrict EPC text to the SEPA Latin subset.
payments.bysquare.version1.2.0QR_BYSQUARE_VERSION1.0.0, 1.1.0 or 1.2.0 (beneficiary name mandatory).
payments.bysquare.deburrtrueQR_BYSQUARE_DEBURRStrip 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=true

Inspecting 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 about

Show 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 crypto

By 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.