Weave 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

chillerlan/php-qrcode is a PHP QR Code library for generating and reading codes, based on Kazuhiko Arase's generator and a ZXing port. It supports Model 2 versions 1-40, L/M/Q/H error correction, mixed encoding modes, and configurable output.

View on GitHub
Deep Wiki
Context7

chillerlan/php-qrcode is a modern PHP library for generating Model 2 QR Codes (versions 1–40), based on the classic Kazuhiko Arase implementation but namespaced, cleaned up and extended. It also ships a built-in QR Code reader, ported from ZXing, so encoding and decoding live in one dependency.

  • Mixed mode encoding — numeric, alphanumeric, byte and Kanji modes can be combined in a single symbol
  • All ECC levels — L/M/Q/H error correction supported
  • Flexible output — renders to SVG, HTML, PNG, and more via chillerlan/php-settings-container
  • Customizable — colors, module shapes, margins, and ECI support
  • Fully documented — readthedocs guide plus a JS port on NPM
Frequently asked questions about Php Qrcode
How do I install chillerlan/php-qrcode in a Laravel app?
Install it with Composer using composer require chillerlan/php-qrcode. For PHP 8.2 environments, pin to the 6.0.x line rather than floating on dev-main, because main/v7 requires PHP 8.4. There is no Laravel auto-discovery step; you instantiate the library directly or behind your own adapter.
Does chillerlan/php-qrcode support Laravel 10, 11, and 12?
Laravel 11 and 12 applications on PHP 8.2 or newer can use the 6.0.x release line. Laravel 10 apps still running PHP 8.1 are blocked until PHP is upgraded, since 6.0.x requires PHP 8.2. Do not follow the README blindly if it advertises PHP 8.4+, as that documentation tracks main/v7 rather than the stable 6.0.x line.
Do I need a Laravel service provider, facade, or config file for this package?
No. chillerlan/php-qrcode is a plain PHP library, not a Laravel package, so it ships no service provider, facade, or publishable config. The recommended approach is to create a small app-level contract such as QrCodeGenerator and bind QROptions from your own config/qrcode.php. That wrapper keeps controllers and jobs independent of the vendor API and makes future upgrades or replacement easier.
How do I generate SVG and PNG QR codes in Laravel with chillerlan/php-qrcode?
Use QRCode with QROptions and select the output interface for SVG, HTML, PNG/GD, ImageMagick, EPS, PDF, JSON, or XML. SVG is the best fit for inline web views because it avoids raster extension requirements, while PNG needs ext-gd or ext-imagick in the container image. Output format should be a configuration decision behind your adapter, not a fork in application code.
Can chillerlan/php-qrcode read or decode QR codes from user-uploaded images?
Yes. The package includes a ZXing-derived reader under an Apache-2.0 NOTICE, so inbound-scan use cases like ticket redemption, KYC document parsing, and invoice QR decoding are supported without adding a second vendor. Reading is heavier than generation: it needs GD or Imagick, consumes more memory and CPU, and can be affected by Imagick policy files. Treat recognition as a medium-risk path and test it separately from QR generation.
What PHP extensions and container requirements does chillerlan/php-qrcode need?
ext-mbstring is required. ext-gd or ext-imagick is needed only if you emit raster output or use the reader, setasign/fpdf is needed only for PDF output, and ext-fileinfo is needed for ImageMagick. These should be explicit requirements in your Laravel container image rather than assumed. SVG generation has the lightest extension footprint.
How should I configure error correction, version, margin, and output format?
Bind QROptions from a config/qrcode.php file so product choices such as ECC level L/M/Q/H, QR version, margin, scale, and outputInterface are configuration rather than code changes. chillerlan/php-qrcode supports Model 2 QR versions 1 through 40 and mixed encoding modes. Keeping these options behind your own adapter also makes it possible to swap implementations later without touching controllers.
Is chillerlan/php-qrcode production-ready for a Laravel application?
Generation is low-risk in production: it is pure PHP, has no runtime services, no database, and no queue dependency, and Apache-2.0 licensing is commercially safe with attribution and NOTICE propagation plus the Denso Wave QR Code trademark caveat for user-facing labels. The main risks are roadmap churn and a single primary maintainer, so pin 6.0.x, never float dev-main, and wrap the library in an internal abstraction. Reading/decoding should be treated separately as medium risk because image decoding is more failure-prone.
How do I test QR code generation in Laravel without brittle tests?
Test your app-level adapter or contract rather than asserting pixel-perfect vendor output. For SVG, assert that the result is a valid SVG string and that it encodes the expected payload where feasible; for PNG or decoding flows, use fixture images or the reader path in a focused integration test. Keep static payload tests deterministic and cache QR assets by payload hash where appropriate. This approach also protects you when upgrading from 6.0.x to v7.
What are the alternatives to chillerlan/php-qrcode, and when should I use them?
Bacon/Bacon-QR-Code is a common generation-only alternative, and simplesoftwareio/simple-qrcode is a Laravel-oriented wrapper some teams already use. There is also a JavaScript port, @chillerlan/qrcode, for frontend rendering. Choose chillerlan/php-qrcode when you need both generation and reading, many output formats, or want to avoid adding a second QR vendor for inbound scanning.
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.
takashato/laravel-vietqr
aitor24/laralang
kraenzle-ritter/entity-relations
dindigital/din-image
pomirleanu/image-colors
sawmainek/laravel-api-generator
delatbabel/jsonresponses
mouhamedfd/permissions-generator
eduplus/qr
laravel2580/idehelpers
delatbabel/viewpages
anavel/gettext
muhamadrezaar/highcharts
delatbabel/keylists
frankkessler/salesforce-laravel-oauth2-rest
anavel/foundation
wdmtech/enviricons
eii/laravel-captcha
muka/shape-reader
tdt/json