matthijs-neijenhuijs/filament-qr-button
Composer 安装命令:
composer require matthijs-neijenhuijs/filament-qr-button
包简介
A Filament table column component for displaying QR codes based on record URLs
README 文档
README
A powerful Filament table column component that generates QR codes based on URLs in your record data. Built on top of lara-zeus/simple-qrcode.
Features
- 🎯 Generate QR codes from record URLs
- 🎨 Customizable button labels and modal headings
- 📏 Adjustable QR code size
- 🖼️ Multiple format support (SVG, PNG, EPS, PDF)
- 🔒 Error correction level configuration (L, M, Q, H)
- 💬 Modal or inline display modes
- ⚡ Dynamic URL generation using closures
- 🎭 Full Filament theming support
Installation
You can install the package via composer:
composer require matthijs-neijenhuijs/filament-qr-button
The package will automatically register its service provider.
Dependencies
This package automatically installs lara-zeus/simple-qrcode which provides QR code generation capabilities.
Publishing Configuration (Optional)
You can optionally publish the config file:
php artisan vendor:publish --tag="filament-qr-button-config"
You can optionally publish the views:
php artisan vendor:publish --tag="filament-qr-button-views"
Quick Start
Basic Usage
use MatthijsNeijenhuijs\FilamentQrButton\QrCodeColumn; public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name'), QrCodeColumn::make('qr_code') ->qrUrl('url') // Column containing the URL ->buttonLabel('View QR'), ]); }
Dynamic URL Generation
QrCodeColumn::make('qr_code') ->qrUrl(fn ($record) => route('products.show', $record)) ->buttonLabel('Product QR') ->modalHeading('Product QR Code')
Configuration Options
Note: We use
qrUrl()instead ofurl()to avoid conflicts with Filament's built-inurl()method on table columns, which is used for making the entire column clickable.
URL Source
Define where to get the URL from:
// From a database column QrCodeColumn::make('qr_code') ->qrUrl('product_url') // Using a closure for dynamic URL generation QrCodeColumn::make('qr_code') ->qrUrl(fn ($record) => "https://example.com/track/{$record->tracking_code}")
QR Code Size
Set the size of the generated QR code (in pixels):
QrCodeColumn::make('qr_code') ->qrUrl('url') ->size(200) // Default is 150
Button Label
Customize the button text:
QrCodeColumn::make('qr_code') ->qrUrl('url') ->buttonLabel('Show QR Code')
Modal Configuration
Control the modal display:
QrCodeColumn::make('qr_code') ->qrUrl('url') ->showInModal(true) // Default is true ->modalHeading('Scan this QR Code')
Display Inline (Without Modal)
Show the QR code directly in the table:
QrCodeColumn::make('qr_code') ->qrUrl('url') ->showInModal(false) ->size(80) // Smaller size for inline display
Error Correction Level
Set the QR code error correction level:
QrCodeColumn::make('qr_code') ->qrUrl('url') ->errorCorrectionLevel('H') // High error correction
Error correction levels:
L- Low (7% correction)M- Medium (15% correction) - DefaultQ- Quartile (25% correction)H- High (30% correction)
Output Format
Choose the output format:
QrCodeColumn::make('qr_code') ->qrUrl('url') ->format('svg') // svg, png, eps, pdf (default: svg)
Real-World Examples
Product URL QR Code
QrCodeColumn::make('product_qr') ->label('Product QR') ->qrUrl(fn ($record) => route('products.public', $record)) ->buttonLabel('QR Code') ->modalHeading('Product QR Code') ->size(200) ->errorCorrectionLevel('H')
Order Tracking QR Code
QrCodeColumn::make('tracking_qr') ->label('Tracking') ->qrUrl(fn ($record) => "https://tracking.example.com/{$record->tracking_number}") ->buttonLabel('Track') ->modalHeading('Track Your Order')
Warehouse Location QR Code
QrCodeColumn::make('location_qr') ->label('Location') ->qrUrl(fn ($record) => route('warehouse.location', ['location' => $record->location_code])) ->buttonLabel('Location QR') ->size(150)
Invoice QR Code (Inline Display)
QrCodeColumn::make('invoice_qr') ->label('Invoice QR') ->qrUrl(fn ($record) => route('invoices.download', $record)) ->showInModal(false) ->size(60)
Advanced Usage
Conditional Display
QrCodeColumn::make('qr_code') ->qrUrl('url') ->visible(fn ($record) => $record->is_active && $record->url !== null)
Dynamic Button Labels
QrCodeColumn::make('qr_code') ->qrUrl('url') ->buttonLabel(fn ($record) => $record->qr_label ?? 'QR Code')
Dynamic Size
QrCodeColumn::make('qr_code') ->qrUrl('url') ->size(fn ($record) => $record->is_important ? 200 : 150)
Custom Modal Headings
QrCodeColumn::make('qr_code') ->qrUrl('url') ->modalHeading(fn ($record) => "QR Code for {$record->name}")
Complete Example
Here's a complete example in a Filament resource:
<?php namespace App\Filament\Resources; use App\Models\Product; use MatthijsNeijenhuijs\FilamentQrButton\QrCodeColumn; use Filament\Resources\Resource; use Filament\Tables\Table; use Filament\Tables\Columns\TextColumn; class ProductResource extends Resource { protected static ?string $model = Product::class; public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('reference_code') ->searchable(), TextColumn::make('name') ->searchable(), TextColumn::make('ean') ->label('EAN') ->searchable(), QrCodeColumn::make('product_qr') ->label('QR Code') ->qrUrl(fn ($record) => route('products.show', $record)) ->buttonLabel('View QR') ->modalHeading('Product QR Code') ->size(180) ->errorCorrectionLevel('H'), ]); } }
Configuration File
The default configuration can be customized in config/filament-qr-button.php:
return [ 'default_size' => 150, 'default_error_correction' => 'M', 'default_format' => 'svg', 'default_button_label' => 'QR Code', 'show_in_modal' => true, 'default_modal_heading' => 'QR Code', ];
Tips & Best Practices
- Performance: For large tables, enable pagination to avoid generating too many QR codes at once
- Size: Keep QR codes between 100-200px for optimal scanning
- Error Correction: Use higher error correction (Q or H) for QR codes that might be damaged
- URLs: Ensure URLs are publicly accessible if QR codes will be scanned by external users
- Testing: Always test QR codes with different scanner apps
Troubleshooting
QR Code Not Displaying
- Ensure the URL attribute exists on your model
- Check that the URL is not null or empty
- Verify dependencies are installed:
composer show lara-zeus/simple-qrcode
Modal Not Opening
- Clear your browser cache
- Ensure Livewire is properly loaded
- Check browser console for JavaScript errors
QR Code Quality Issues
- Increase the
size()parameter - Use a higher
errorCorrectionLevel()(Q or H) - Consider using SVG format for better quality
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email your.email@example.com instead of using the issue tracker.
Credits
- Your Name
- Built on lara-zeus/simple-qrcode
- Built for Filament PHP
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
matthijs-neijenhuijs/filament-qr-button 适用场景与选型建议
matthijs-neijenhuijs/filament-qr-button 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「qr-code」 「filament」 「filament-plugin」 「table-column」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 matthijs-neijenhuijs/filament-qr-button 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matthijs-neijenhuijs/filament-qr-button 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 matthijs-neijenhuijs/filament-qr-button 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
QR Code generator
Based in http://phpqrcode.sourceforge.net/
A clean, modern, and easy-to-use QR code generator for Laravel
Laravel helper to generate the QRcode for ZATCA E-Invoicing system
PHP library for generating PAY by square payment QR codes
Modern QR Code Generator for PHP - Support for multiple output formats and QR code types
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-09