Skip to main content
Installing Laravel QR Code takes about a minute. The package uses Laravel’s package auto-discovery, so you won’t touch config/app.php at all — just require the package and start generating.
1

Require the package

Run the following command from your project root:
Composer resolves the package and its only production dependency, bacon/bacon-qr-code.
2

Confirm auto-discovery (nothing to do)

Laravel automatically registers the service provider and the QrCode facade alias. You don’t need to edit config/app.php.To verify, run:
You should see Linkxtr\QrCode\QrCodeServiceProvider listed under Providers.
If your application has disabled package auto-discovery, add the provider and alias manually in config/app.php:
3

Publish the config (optional)

If you want to set app-wide defaults — such as a different output format, a custom size, or a brand color — publish the config file:
This creates config/qrcode.php in your project:
config/qrcode.php

Environment variable overrides

Every key in the config file reads from a corresponding environment variable, so you can change defaults per-environment without touching the published file:
Config-driven defaults apply automatically when you use the QrCode facade, the <x-qr-code> Blade component, or resolve Linkxtr\QrCode\Generator from Laravel’s container. They do not apply when you call new Generator() directly without passing a config array.
4

Install ext-imagick for PNG/WebP (optional)

SVG and EPS output require no image extensions. For PNG and WebP, the package needs either ext-imagick or ext-gd.

Imagick (recommended)

Provides higher-quality raster output. Install via your system package manager:

GD (automatic fallback)

GD ships with most PHP distributions. If ext-imagick is not detected, the package silently falls back to GD for PNG and WebP — no configuration needed.
ext-imagick is required for several raster features:
  • WebP output — GD can produce PNG but not WebP.
  • Non-square module stylesdot and round styles require Imagick.
  • Gradients — multi-color foreground gradients require Imagick.
  • Custom eye colors — per-eye color overrides set with eyeColor() require Imagick.
Using any of these features without Imagick throws a MissingExtensionException. SVG and EPS output are unaffected and support every feature without Imagick.
To force GD even when Imagick is present, set QR_CODE_FORCE_GD=true in your .env file or publish the config and set 'force_gd' => true.

What’s installed

After completing the steps above, your application has:
  • The QrCode facade available globally
  • The <x-qr-code> and <x-qrcode> Blade components registered
  • The php artisan qr:generate Artisan command available
  • An optional config/qrcode.php with app-wide defaults
Continue to the Quickstart to generate your first QR code.