Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Qrcode Laravel Package

chillerlan/php-qrcode

Generate and read QR codes in PHP with a modern, namespaced library. Supports Model 2 QR Codes (versions 1–40), ECC levels L/M/Q/H, mixed encoding modes, multiple output formats, and includes a QR Code reader based on ZXing.

View on GitHub
Deep Wiki
Context7

A PHP QR Code generator and reader with a user-friendly API.

Frequently asked questions about Php Qrcode
How do I generate a QR code in Laravel Blade using chillerlan/php-qrcode?
Bind the QRCode class to Laravel’s service container in `AppServiceProvider`, then render SVG directly in Blade: ` {!! app(QRCode::class)->render('https://example.com', 'svg') !!} `. For PNG output, store the binary in Laravel’s filesystem or return it as a response.
Does this package support dynamic QR codes (e.g., time-limited tokens)?
Yes, but avoid caching dynamic QR codes. Generate them on-demand (e.g., in a controller) and use deterministic data (e.g., `user_id+timestamp`) to ensure uniqueness. For sensitive data, regenerate the QR code after use or set short cache TTLs.
Can I use this package with Laravel’s API responses (e.g., JSON/XML)?
Absolutely. Use the `json` or `xml` output format to embed QR data in API responses: `return response()->json(['qr_data' => app(QRCode::class)->render('data:...', 'json')])`. For binary outputs like PNG, base64-encode the result and include it in the response.
What Laravel versions and PHP requirements does chillerlan/php-qrcode support?
The package requires PHP 8.2+ (Laravel 9+). For PHP 8.1 or older, use v6.x. Laravel compatibility is high due to its modular design, but test with your PHP version—especially if using dev-main. Check the [README](https://github.com/chillerlan/php-qrcode) for version-specific notes.
How do I read QR codes in uploaded images (e.g., for validation)?
Use the built-in `QRCodeReader` class: `$reader = new QRCodeReader(); $result = $reader->readImage('path/to/uploaded.png');`. Validate the decoded data against your database (e.g., check if a scanned invoice ID exists). For production, handle exceptions (e.g., unreadable codes) gracefully.
Are there performance concerns when generating thousands of QR codes?
Yes, QR generation is CPU-intensive. For bulk operations, use Laravel queues to process jobs asynchronously. Cache static QR codes (e.g., product links) with Redis or filesystem caching. Benchmark with your server’s load—consider downgrading ECC levels for less critical data.
Can I customize the QR code appearance (e.g., colors, logo overlay)?
The package supports basic styling via options like `size`, `margin`, and `errorCorrectionLevel`. For advanced customization (e.g., logos), extend the `QRCode` class or use a wrapper like `chillerlan/php-qrcode-extended`. SVG output allows further CSS tweaks in Blade.
What are the alternatives to chillerlan/php-qrcode for Laravel?
Alternatives include `endroid/qr-code` (simpler API, less features) or `bacon/bacon-qr-code` (pure PHP, no dependencies). For frontend scanning, pair this package with JavaScript libraries like `@chillerlan/qrcode` (NPM) or `zxing-js`. Choose based on your need for reader capabilities or output formats.
How do I integrate PDF QR codes into Laravel invoices using FPDF?
Install `setasign/fpdf` via Composer, then generate a PDF QR code: `$pdf = new FPDF(); $qr = app(QRCode::class)->render('invoice-123', 'pdf'); $pdf->AddPage(); $pdf->writeHTML($qr);`. Save the PDF to storage or stream it as a download. For dynamic invoices, generate the QR code in the same transaction as the invoice creation.
Is there a way to detect if a scanned QR code has been tampered with?
The package itself doesn’t detect tampering, but you can implement checks by storing a hash of the original QR data (e.g., in the database) and comparing it to the scanned result. For critical applications, use signed URLs or time-limited codes to mitigate risks. Combine with the reader’s validation for added security.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony