ejoi8/filament-qr-scanner

QR scanner plugin for Filament tables and text inputs.

Maintainers

Package info

github.com/ejoi8/filament-qr-scanner

Language:Blade

pkg:composer/ejoi8/filament-qr-scanner

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-04 01:55 UTC

This package is auto-updated.

Last update: 2026-04-04 01:56:44 UTC


README

QR scanner utilities for Filament tables and form fields.

GitHub: ejoi8/filament-qr-scanner

Requirements

  • PHP 8.3+
  • Laravel 13.x
  • Filament 5.4.x

What It Does

  • provides a ready-made Scan header action
  • opens a camera scanner in a Filament modal
  • applies the scanned value to tableSearch
  • adds TextInput::qrScan() for scanning directly into a field
  • keeps normalization overridable per host page

Installation

Published Package

composer require ejoi8/filament-qr-scanner
php artisan filament:assets

Local Path Package

If you are consuming the package locally before publishing it:

{
    "repositories": [
        {
            "type": "path",
            "url": "../filament-qr-scanner"
        }
    ]
}
composer require ejoi8/filament-qr-scanner
php artisan filament:assets

Register The Plugin

Register the panel plugin in your Filament panel provider:

use FilamentQrScanner\FilamentQrScannerPlugin;

return $panel
    ->plugin(FilamentQrScannerPlugin::make());

Use On A ListRecords Page

Add the trait and the ready-made header action to your Filament ListRecords page:

<?php

namespace App\Filament\Resources\Products\Pages;

use App\Filament\Resources\Products\ProductResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use FilamentQrScanner\Tables\Actions\ScanTableSearchAction;
use FilamentQrScanner\Tables\Concerns\InteractsWithScannedTableSearch;

class ListProducts extends ListRecords
{
    use InteractsWithScannedTableSearch;

    protected static string $resource = ProductResource::class;

    protected function getHeaderActions(): array
    {
        return [
            ScanTableSearchAction::make(),
            CreateAction::make(),
        ];
    }
}

Use On A Text Input

Once the plugin is registered, any Filament TextInput can add a QR scan suffix action:

use Filament\Forms\Components\TextInput;

TextInput::make('serial_no')
    ->qrScan();

Scanning writes the captured value back into that field's state path, then closes the modal.

Custom Normalization

By default, the package only applies trim() to the scanned value.

If your table searches uppercase identifiers, override the normalization method on the host page:

use Illuminate\Support\Str;

protected function normalizeScannedTableSearch(string $code): string
{
    return Str::upper(trim($code));
}

Scope

Current scope:

  • Filament ListRecords pages only
  • Filament TextInput fields via ->qrScan()

Not included yet:

  • relation managers
  • non-TextInput form fields
  • configurable labels or debounce timing

Notes

  • The scanner writes to Filament's tableSearch flow through applyScannedTableSearch().
  • Camera access requires https:// or localhost.
  • After package updates, run php artisan filament:assets.
  • Source: https://github.com/ejoi8/filament-qr-scanner