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 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 background color. Accepts the same three formats as
QR_CODE_COLOR.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.Enables or disables automatic caching of generated QR code results. When enabled, identical requests reuse cached output to eliminate duplicate rendering overhead.
Sets the cache time-to-live in seconds. The default is 86400 seconds (24 hours).
Specifies the cache store to use for storing cached QR codes (e.g.
redis, memcached, database, or file). When set to null or omitted, the package uses your default Laravel cache repository defined in config/cache.php.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.