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. Supports Model 2 QR codes (versions 1–40), ECC levels L/M/Q/H, mixed encoding modes, and multiple output formats. Includes a QR code reader based on a PHP port of ZXing.

View on GitHub
Deep Wiki
Context7

chillerlan/php-qrcode is a modern, namespaced PHP QR Code generator based on Kazuhiko Arase’s reference implementation, with cleanup and improvements. It also includes a QR Code reader powered by a PHP port of ZXing, enabling both creation and decoding in one package.

Designed for flexibility and standards compliance, it supports Model 2 QR Codes across Versions 1–40, multiple ECC levels, and mixed encoding modes for optimal data density.

  • Generate Model 2 QR Codes (Versions 1–40)
  • Supports ECC levels: L/M/Q/H
  • Mixed mode encoding (combine multiple data modes)
  • Multiple output/render options via configurable settings
  • Includes a QR reader/decoder (ZXing-based)
Frequently asked questions about Php Qrcode
How do I install **chillerlan/php-qrcode** in a Laravel project?
Run `composer require chillerlan/php-qrcode` in your project root. The package has no Laravel-specific dependencies and works with PHP 8.4+. Ensure `ext-mbstring` is enabled for Unicode support. No additional Laravel setup is required.
Can I generate QR codes dynamically in Laravel Blade templates?
Yes. Use the `QRSvg` or `QRGdImage` renderers to generate QR codes inline. For example, embed an SVG directly in Blade: `{{ QRSvg::render($data) }}`. For images, stream the output via a route or store it in Laravel’s filesystem.
What Laravel versions does this package support?
The package is framework-agnostic and works with any Laravel version supporting PHP 8.4+. Tested compatibility exists with Laravel 10+ and 11, but no Laravel-specific features are required. Focus on PHP version support instead.
How do I return a QR code as an image response in a Laravel API?
Use Laravel’s `Response` helper: `return response($qrCode->render('image/png'), 200, ['Content-Type' => 'image/png']);`. Replace `'image/png'` with `'image/jpeg'` or `'svg'` as needed. Ensure the output module (e.g., `QRGdImage`) is installed.
Does this package support QR code reading/scanning in PHP?
Yes, it includes a ZXing-based reader. Use `QRReader::read()` with a file path or binary data. Requires `ext-gd` or `ext-imagick` for image decoding. Example: `$data = QRReader::read('path/to/qr.png');`
What are the performance implications of generating thousands of QR codes?
Heavy usage may strain server resources. Offload generation to Laravel Queues or use caching (e.g., `Cache::remember()`). For bulk operations, consider async jobs or pre-generating static QR codes for common data.
How do I handle unsupported QR code data (e.g., custom ECI modes)?
Wrap generation in a `try-catch` block. The package throws exceptions for unsupported formats. Validate input data (e.g., URLs, OTPs) before encoding. For advanced use cases, check the [documentation](https://php-qrcode.readthedocs.io) for custom ECI mode support.
What are the required PHP extensions for full functionality?
Critical: `ext-mbstring` (required for encoding). Optional but recommended: `ext-gd` or `ext-imagick` (for image output), `setasign/fpdf` (for PDF output). Test your environment with `php -m` to confirm availability.
Can I use this package to validate uploaded QR codes in Laravel?
Yes. Use the built-in reader to decode uploaded files (e.g., from a form). Example: `$reader = new QRReader(); $decoded = $reader->read(storage_path('uploads/qr.png'));`. Combine with Laravel’s validation rules for security.
Are there alternatives to this package for Laravel QR code generation?
Yes. Alternatives include `endroid/qr-code` (Laravel-specific wrapper) or `bacon/bacon-qr-code` (simpler but less feature-rich). **chillerlan/php-qrcode** stands out for its Model 2 support, mixed encoding, and built-in reader. Choose based on your need for advanced features or simplicity.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport