config/qrcode.php reads from a corresponding environment variable, so you can control package-wide defaults through your .env file without publishing or editing any PHP config. This is ideal for twelve-factor apps, containerized deployments, and multi-environment setups where each environment needs different QR code settings.
All supported environment variables
Add any of the following entries to your.env file. Omitting a variable leaves the built-in default in effect.
.env
Variable reference
Sets the default image format for every generated QR code.
| Value | Notes |
|---|---|
svg | Vector format. Scales perfectly at any size. No image extension needed. |
png | Raster — requires GD or Imagick |
webp | Modern raster — requires GD or Imagick |
eps | Vector format for print. Image merging is not supported. |
Sets the default pixel dimensions of the generated QR code. For
svg and eps this controls the viewBox size; for png and webp it sets the actual pixel dimensions.Sets the default quiet zone (blank border) around the QR code in module units. The QR code specification recommends a minimum of 4 for reliable scanning.
Sets the default foreground (module) color. Three formats are accepted:
| Format | Example value |
|---|---|
| RGB comma-separated | 0,0,0 |
| RGBA comma-separated (alpha 0–100) | 0,0,0,100 |
| Hex | #000000 |
Sets the default background color. Accepts the same three formats as
QR_CODE_COLOR.Sets the default Reed-Solomon error correction level.
| Value | Recovery capacity | When to use |
|---|---|---|
L | ~7 % | Clean digital displays |
M | ~15 % | General purpose (default) |
Q | ~25 % | Printed materials |
H | ~30 % | Codes with an embedded logo |
Sets the default character encoding applied to the data payload before it is encoded. Only change this if you need a specific non-Unicode encoding supported by the underlying
bacon/bacon-qr-code library.When set to
true, the package skips Imagick and renders raster images using PHP’s GD extension, even when Imagick is available. Use this when your server installs Imagick but restricts it via security policies.Environment-specific examples
Use different defaults for local development vs. production without changing any PHP code:Color format reference
Environment variables are read by
config/qrcode.php at boot time. You do
not need to publish the config file to use env vars. The unpublished config
that ships with the package already calls env('QR_CODE_*', ...) for every
option. Publishing the config only adds the ability to set PHP array values
(such as [R, G, B]) directly in PHP, which is not possible in a .env file.