Skip to content

Configuration ​

Publish the config with php artisan vendor:publish --tag=qr-config. Every value is a plain value - strings, numbers, arrays, class names, enum cases, color instances - so php artisan config:cache keeps working. Closures and other objects are registered in code instead, in a service provider.

defaults ​

What every code starts from.

KeyDefault
error_correctionErrorCorrection::Mediuman enum case or L, M, Q, H
margin4modules of quiet zone
size600pixels, for PNG, JPEG and WebP without a size
foreground#000000any color
background#ffffffany color, or null for transparent
moduleModule::Squarea module shape: name, enum case or class
eyeEye::Squarean eye preset
stylenulla named style every code starts from

cache ​

KeyDefault
enabledfalse (QR_CACHE)cache every code across requests
storenull (QR_CACHE_STORE)a cache store by name; the default store when null
ttl604800seconds
prefixqrthe cache keys' prefix
version1raise to make every cached code stale

See Caching.

scan_safety ​

KeyDefault
min_contrast3.0
on_violationthrow, or warn
min_margin2
max_offset0.15
min_scale0.6
max_scale1.25
max_skew20
max_skip0.25
max_logo_share0.6
outer_eye_scale[0.93, 1.0]
inner_eye_scale[0.6, 1.15]
eye_rotation_warning10

null turns a guard off. See Scan safety.

metadata ​

Attribution written into every code's file: title, author, description, copyright, url and keywords (a list). A code's own ->metadata() is merged over these. See Output.

svg and png ​

KeyDefault
svg.precision3decimals in path data
svg.xml_declarationfalsestart SVG files with <?xml ...?>
png.dpinulla resolution written into PNG, JPEG and WebP files

colors ​

Color names of your own, usable anywhere a color goes: 'brand' => '#be123c'. Values are any color notation, a color instance or an array. See Colors.

streams ​

KeyDefault
max_memory2 MB (QR_STREAM_MAX_MEMORY)bytes an output keeps in memory before moving to a temporary file
KeyDefault
logos.sanitizerAutoSvgSanitizerthe class that sanitizes SVG logos: enshrined/svg-sanitize when installed, the package's own allowlist otherwise
logo.auto_error_correctiontrueraise codes with a logo to error correction H

reading ​

KeyDefault
decoderstack (QR_DECODER)the decoder Qr::read() uses
stack['zxing', 'native']what the stack tries, in order
zxing.command['node']what runs Node
zxing.node_modulesnullwhere zxing-wasm is installed; the application's own node_modules when null
zxing.timeout10seconds per read

See Reading codes.

monocle ​

KeyDefault
enabledtrue (QR_MONOCLE)show codes in Monocle, when it is installed
slow_render_ms50renders slower than this are flagged

Registries ​

Parts of your own by name, next to the built-in ones: modules, outer_eyes, inner_eyes, eyes, filters, gradients, payloads, writers, decoders and styles. Each entry is one of:

php
'modules' => [
    'pill' => App\Qr\PillModule::class,                         // a class
    'pill-thin' => [App\Qr\PillModule::class, 'width' => 0.4], // a class with options
    App\Qr\Shapes::class,                                      // an enum: every case under its value
],

A name registered in code wins over one in the config, which wins over a built-in one, so a built-in name can be replaced. See Extending.