QROptionsTrait
The QRCode plug-in settings & setter functionality
- Full name:
\chillerlan\QRCode\QROptionsTrait
Properties
version
QR Code version number
[1 ... 40] or QRCode::VERSION_AUTO
versionMin
Minimum QR version
if $version = QRCode::VERSION_AUTO
versionMax
Maximum QR version
eccLevel
Error correct level
QRCode::ECC_X where X is:
- L => 7%
- M => 15%
- Q => 25%
- H => 30%
maskPattern
Mask Pattern to use
[0...7] or QRCode::MASK_PATTERN_AUTO
addQuietzone
Add a "quiet zone" (margin) according to the QR code spec
quietzoneSize
Size of the quiet zone
internally clamped to [0 ... $moduleCount / 2], defaults to 4 modules
dataModeOverride
Use this to circumvent the data mode detection and force the usage of the given mode.
valid modes are: Number, AlphaNum, Kanji, Byte (case insensitive)
See Also:
- https://github.com/chillerlan/php-qrcode/issues/39 - * https://github.com/chillerlan/php-qrcode/issues/97 - (changed default value to '')
outputType
The output type
- QRCode::OUTPUT_MARKUP_XXXX where XXXX = HTML, SVG
- QRCode::OUTPUT_IMAGE_XXX where XXX = PNG, GIF, JPG
- QRCode::OUTPUT_STRING_XXXX where XXXX = TEXT, JSON
- QRCode::OUTPUT_CUSTOM
outputInterface
the FQCN of the custom QROutputInterface if $outputType is set to QRCode::OUTPUT_CUSTOM
cachefile
/path/to/cache.file
eol
newline string [HTML, SVG, TEXT]
scale
size of a QR code pixel [SVG, IMAGE_*], HTML via CSS
cssClass
a common css class
svgOpacity
SVG opacity
svgDefs
anything between
See Also:
- https://developer.mozilla.org/docs/Web/SVG/Element/defs -
svgViewBoxSize
SVG viewBox size. a single integer number which defines width/height of the viewBox attribute.
viewBox="0 0 x x"
See Also:
- https://css-tricks.com/scale-svg/#article-header-id-3 -
textDark
string substitute for dark
textLight
string substitute for light
markupDark
markup substitute for dark (CSS value)
markupLight
markup substitute for light (CSS value)
returnResource
Return the image resource instead of a render if applicable.
This option overrides other output options, such as $cachefile and $imageBase64.
Supported by the following modules:
- QRImage: resource (PHP < 8), GdImage
- QRImagick: Imagick
- QRFpdf: FPDF
See Also:
- \chillerlan\QRCode\Output\QROutputInterface::dump() -
imageBase64
toggle base64 or raw image data
imageTransparent
toggle transparency, not supported by jpg
imageTransparencyBG
See Also:
- \chillerlan\QRCode\imagecolortransparent() - [R, G, B]
pngCompression
See Also:
- \chillerlan\QRCode\imagepng() -
jpegQuality
See Also:
- \chillerlan\QRCode\imagejpeg() -
imagickFormat
Imagick output format
See Also:
- \Imagick::setType() -
imagickBG
Imagick background color (defaults to "transparent")
See Also:
- \ImagickPixel::__construct() -
fpdfMeasureUnit
Measurement unit for FPDF output: pt, mm, cm, in (defaults to "pt")
See Also:
- \FPDF::__construct() -
moduleValues
Module values map
- HTML, IMAGICK: #ABCDEF, cssname, rgb(), rgba()...
- IMAGE: [63, 127, 255] // R, G, B
Methods
setMinMaxVersion
clamp min/max version number
Parameters:
Parameter | Type | Description |
---|---|---|
$versionMin |
int | |
$versionMax |
int |
set_versionMin
sets the minimum version number
Parameters:
Parameter | Type | Description |
---|---|---|
$version |
int |
set_versionMax
sets the maximum version number
Parameters:
Parameter | Type | Description |
---|---|---|
$version |
int |
set_eccLevel
sets the error correction level
Parameters:
Parameter | Type | Description |
---|---|---|
$eccLevel |
int |
Throws:
set_maskPattern
sets/clamps the mask pattern
Parameters:
Parameter | Type | Description |
---|---|---|
$maskPattern |
int |
set_imageTransparencyBG
sets the transparency background color
Parameters:
Parameter | Type | Description |
---|---|---|
$imageTransparencyBG |
array |
Throws:
set_version
sets/clamps the version number
Parameters:
Parameter | Type | Description |
---|---|---|
$version |
int |
set_fpdfMeasureUnit
sets the FPDF measurement unit
Parameters:
Parameter | Type | Description |
---|---|---|
$unit |
string |
Automatically generated on 2025-03-18