Back to README · Scanning · Batch collecting · Generating · Customizing
Recipes: POS checkout · Goods receiving · Work-order station · Label generator page · Print to PDF · Custom inputs · Styling. Upgrading from an earlier release: UPGRADE.md. Label printing: printing.md.
Configuration, browser events and translations. How-to material lives in customizing.md and extending.md; every public method is in the API map.
Everything documented here and in the guides is public API and follows semver. Classes and methods tagged @internal in a docblock (render cache and spec classes, client payloads, the Livewire and Filament hooks a component must keep public) are not: they can change in any release, including a minor or patch release. Don't call or extend them from app code.
Publish the config to tune defaults (config/qr-code.php):
php artisan vendor:publish --tag="filament-qr-code-config"Per-component options override these defaults:
use Mmuqiitf\FilamentQrCode\Enums\BarcodeFormat;
use Mmuqiitf\FilamentQrCode\Enums\ScannerPreset;
use Mmuqiitf\FilamentQrCode\Forms\Components\QrScanner;
QrScanner::make('sku')
->preset(ScannerPreset::Warehouse) // optional camera bundle (retail, warehouse, inventory, ticketing, gs1)
->fps(25)
->qrbox(250) // responsive max when no scanRegion is active; the decode box scales to the viewfinder
->scanRegion(0.80, 0.55) // replaces qrbox; ratios <= 1.0, integers > 1 are pixel maxima
->formats([BarcodeFormat::QrCode, BarcodeFormat::Code128])
->preferRearCamera()
->cameraControls() // torch / zoom when the camera supports them; false hides them
->hardwareScanner(terminators: ['Enter', 'Tab'], minBarcodeLength: 2)
->minFastKeys(3) // keystroke gaps (averaging burstThresholdMs or less) before a terminator counts
->beepFrequency(880)
->beepDuration(80)
->vibrateDuration(100)
// server-checked fields only (see scanning.md → Feedback)
->beep(success: true, error: true)
->vibrate(success: [100], error: [80, 60, 80])
->flash();| Key | Default | Meaning |
|---|---|---|
enabled |
true |
master switch (components also gate individually) |
burst_threshold_ms |
50 |
max gap between keystrokes counted as one burst |
min_barcode_length |
2 |
shorter bursts are treated as typing |
min_fast_keys |
3 |
keystroke gaps required before a terminator counts, averaging burst_threshold_ms or less; 3 rejects fast typists, 1 restores the 0.x behaviour |
fallback_to_any_input |
true |
page-global listener may fill the first empty text, search, number or textarea in the form that contains it when no focused or registered field is free; other forms are left alone; false dispatches qr-scan-unrouted instead. qr-code:doctor warns while this stays on |
scan_timeout_ms |
150 |
flush window for terminator-less guns (0 disables) |
prevent_form_submit |
true |
swallow the terminator key during bursts |
default_terminators |
['Enter', 'Tab'] |
gun suffix keys ending a scan |
default_scope |
'focus' |
where a QrScanner catches wedge scans: 'focus' (only while focused) or 'page' (also when no scan field has focus); override with ->hardwareInput(scope:) |
Auto-repeat keystrokes (a held-down key) never count toward a burst.
Every wedge consumer (QrScanner, QrHardwareScannerListener, QrCollector, QrScanSequence) registers with one page-wide input router, so each burst is handled exactly once. The router picks the owner in this order:
- the
QrScannerwhose camera modal is open; - the focused scan field (a focused
QrScanner, or a focused field registered with a listener); - the first listening target on the page, in page order: page-scope
QrScannerfields (->hardwareInput(scope: HardwareInputScope::Page)), collectors, sequences and each empty field registered with a listener (ranked by the field's own position); - the listener's
fallback_to_any_input; - otherwise
qr-scan-unrouted.
Keys typed into a textarea or a contenteditable editor are left alone and never become a burst, unless the element sits inside a scan target.
A field that can't take the burst (busy checking a scan, too short for its min_barcode_length) is skipped and the next target gets it. When the burst lands somewhere other than the focused input, the characters the gun typed into that input are removed again, unless the input (or an ancestor) has the data-qr-ignore attribute.
These values are the defaults behind every scan surface (QrScanner, QrScanSequence, QrCollector, QrHardwareScannerListener, QrCollectAction): each component ships them to the browser as one payload (getScanPayload()), and any explicit setter (->fps(), ->sound(), ->hardwareScanner(), …) wins over config.
The Station Listener adds its own routing switch:
use Mmuqiitf\FilamentQrCode\Forms\Components\QrHardwareScannerListener;
QrHardwareScannerListener::make(['sku'])
->fallbackToAnyInput(false); // no first-empty-input fallback; dispatch qr-scan-unrouted instead| Key | Default |
|---|---|
sound |
true |
beep_frequency |
880 Hz |
beep_duration_ms |
80 |
vibrate |
true |
vibrate_duration_ms |
100 |
success |
['sound' => true, 'vibrate' => [100], 'flash' => true] |
error |
['sound' => true, 'vibrate' => [80, 60, 80], 'flash' => true] |
| Key | Default | Meaning |
|---|---|---|
preset |
null |
optional ScannerPreset (retail, warehouse, inventory, ticketing, gs1). When set, replaces fps, scan_region, prefer_rear_camera, and controls |
fps |
25 |
decode attempts per second; auto-degrades to 12 when unrestricted and not explicitly set. Unused while a preset is set |
qrbox |
250 |
maximum decode-box edge when no region is active; scales to the viewfinder (wide band only for 1D-only fields) |
scan_region |
null |
optional ['width' => float|int, 'height' => float|int] (ratios <= 1.0, integer pixel maxima > 1). Unused while a preset is set |
prefer_rear_camera |
true |
rear heuristic; the remembered localStorage choice wins. Unused while a preset is set |
controls |
true |
torch / zoom controls, shown only when the running camera reports the capability. Unused while a preset is set |
A preset is a whole camera profile. The four keys it replaces apply only when preset is null. Per-component setters (->fps(), ->scanRegion(), ->qrbox(), ->formats(), ->preferRearCamera(), ->cameraControls()) override the preset in either call order. ->scanRegion() draws the box; ->qrbox() draws it when no region is active. ScannerPreset::Gs1 does not parse GS1 labels — use ->gs1() for that. An invalid scan_region is ignored at runtime; qr-code:doctor warns about it.
| Key | Default | Meaning |
|---|---|---|
cooldown_ms |
1500 |
repeat window for fields with server checks (cooldown()) |
clear_on_reject |
true |
clear the field on a rejected live scan (clearOnReject()) |
continuous.display |
'empty' |
continuous fields after an accepted scan: 'empty' or 'last_code' (continuousDisplay()) |
continuous.pause_on_reject |
false |
false shows the error and keeps scanning; true pauses until dismissed (pauseOnReject()) |
continuous.keep_camera_open |
false |
false closes the camera after each scan (keepCameraOpen()) |
continuous.cooldown_ms |
300 |
repeat window for continuous fields (cooldown() wins) |
sync_options |
'morph' |
when the browser picks up server option changes: 'morph' (every re-render) or 'refresh' (only on a qr-scanner-refresh / qr-sequence-refresh event); syncOptions() per field |
offline |
'banner' |
banner shows an offline notice, block also rejects new scans, off does neither (offline() / blockWhenOffline()) |
Every key of qr-code.sequence; each has a per-component setter that wins over config. Sequence events are in events.md.
| Key | Default | Meaning |
|---|---|---|
on_invalid |
'jump_to_step' |
a failed validateAllUsing(): 'jump_to_step' or 'restart' (onInvalidSequence()) |
auto_submit |
false |
call submit_method once the sequence completes (autoSubmit()) |
submit_method |
'submit' |
the Livewire method autoSubmit() calls |
reset_after_submit |
false |
clear non-sticky steps after a successful submit (resetAfterSubmit()) |
continuous |
false |
start over after every completed sequence (continuous()) |
repeat_complete |
'advance' |
a full repeat(n) step: 'advance' or 'wait' (onRepeatComplete()) |
finish_code |
null |
the scan that finishes a waiting or open-ended repeat step (finishWith()) |
size (300), margin (2), format (svg), foreground_color, background_color, error_correction (M), cache_ttl (86400; null = forever, false = L2 off), cache_store (null = default store), logo_base_paths (null = any readable path; a list of directories logos must live in — see Image route security).
| Key | Default | Meaning |
|---|---|---|
ttl |
null |
minutes a signed image URL stays valid (temporarySignedRoute) for QR previews and barcode columns; also caps Cache-Control: private max-age at the TTL (never above a day). null = never expires |
throttle |
null |
shared rate limit for both image routes, e.g. '60,1' (60 per minute per client); excess requests get 429 |
strict_colors |
false |
require #rrggbb colours on the image route (default accepts #rgb, #rrggbb or bare hex); anything else gets 422 |
middleware |
[] |
extra middleware on both image routes, after signed and the throttle. Class names or aliases. The routes stay off the web group. Non-strings are ignored at registration; qr-code:doctor fails the config |
| Key | Default | Meaning |
|---|---|---|
digital_link.domain |
https://id.gs1.org |
Default domain (scheme + host, optional path prefix) for DigitalLink::build() and QrCodeService::digitalLink() when no per-call domain is given. Trailing slashes are stripped. See GS1 Digital Link |
| Key | Default | Meaning |
|---|---|---|
enabled |
false |
log every server-observed scan (QrCodeScanned) — see Audit scans |
channel |
null |
log channel for the audit lines; null uses the default stack |
Every browser event the package fires, every control event a page can send, and every Laravel event with its properties: see events.md. For every extension seam in one table, see extending.md.
All UI strings live under the filament-qr-code::ui translation namespace. Locales: English (en), Indonesian (id), German (de), French (fr), Spanish (es), Dutch (nl), and Malay (ms). Publish with:
php artisan vendor:publish --tag="filament-qr-code-translations"and translate per locale.
Camera errors and screen-reader announcements are translated too: the browser components receive them from PHP, so a published ui.php covers them. The announcement keys take placeholders: announce_added (:code, :count), announce_step_added (:code, :step), announce_field_added (:code, :field) and announce_rejected (:reason); camera_device takes :id.
The QrScanner field, the collector, the collect-action modal and the scan sequence each have a visually hidden polite live region (data-qr-part="announcer", role="status"). It reads each accepted scan ("Added SKU-1 to SKU" for the field, using its label; "Added ABC-1 (3 items)"; "Added PO-1 to PO") and each rejection ("Rejected: Unknown PO", or "Rejected: This code was rejected." when there is no message) once; the same message is not repeated within 3 seconds. Camera errors stay in a role="alert" region.
Rapid scans do not pile up. Each message replaces the region's text rather than adding to it. The first message is written straight away; messages that arrive within 500 ms of it are coalesced, so only the newest one is written when the window ends. A burst of scans therefore reads the first and the latest result, not every one in between.
Announcements are on by default. QrScanner, QrCollector and QrScanSequence can turn them off or change the wording:
use Mmuqiitf\FilamentQrCode\Forms\Components\QrCollector;
use Mmuqiitf\FilamentQrCode\Forms\Components\QrScanner;
QrScanner::make('badge')
->announcements(false); // or a Closure returning bool
QrCollector::make('items')
->announceUsing(fn (string $code, bool $accepted, ?string $reason, ?string $field): ?string => $accepted
? "Checked in {$code}"
: null); // null keeps the default textThe announceUsing() closure receives $code, $accepted, $reason (the rejection message, or null) and $field (the field label, or the step label in a scan sequence). HTML tags in the returned text are stripped. The closure runs on the server, so setting it adds one Livewire request per scan; when several scans are in flight, only the newest reply is announced.
- Config defaults, translations, styling, print sheets and generator look: customizing.md.
- Live-scan normalization, programmatic triggers and scan auditing: Normalize live scans, Drive scans programmatically, Audit scans.
- Every extension seam in one table: extending.md.