QROptions
extends SettingsContainerAbstract
in package
Uses
QROptionsTrait
The QRCode settings container
Table of Contents
Properties
- $addLogoSpace : bool
- Toggles logo space creation
- $addQuietzone : bool
- Add a "quiet zone" (margin) according to the QR code spec
- $bgColor : mixed|null
- Sets the image background color (if applicable)
- $cachefile : string|null
- Optional cache file path `/path/to/cache.file`
- $circleRadius : float
- Specifies the radius of the modules when $drawCircularModules is set to true
- $connectPaths : bool
- Whether to connect the paths for the several module types to avoid weird glitches when using gradients etc.
- $cssClass : string
- A common css class
- $drawCircularModules : bool
- Specify whether to draw the modules as filled circles
- $drawLightModules : bool
- Whether to draw the light (false) modules
- $eccLevel : int
- Error correct level
- $eol : string
- Newline string
- $excludeFromConnect : array<string|int, mixed>
- Specify which paths/patterns to exclude from connecting if $connectPaths is set to true
- $fpdfMeasureUnit : string
- Measurement unit for FPDF output: pt, mm, cm, in (defaults to "pt")
- $imageBase64 : bool
- $imageTransparent : bool
- Toggle transparency
- $imagickFormat : string
- Imagick output format
- $jsonAsBooleans : bool
- Whether to return matrix values in JSON as booleans or $M_TYPE integers
- $keepAsSquare : array<string|int, mixed>
- Specifies which module types to exclude when $drawCircularModules is set to true
- $logoSpaceHeight : int|null
- Height of the logo space
- $logoSpaceStartX : int|null
- Optional horizontal start position of the logo space (top left corner)
- $logoSpaceStartY : int|null
- Optional vertical start position of the logo space (top left corner)
- $logoSpaceWidth : int|null
- Width of the logo space
- $markupDark : string
- Markup substitute for dark (CSS value)
- $markupLight : string
- Markup substitute for light (CSS value)
- $maskPattern : int
- Mask Pattern to use (no value in using, mostly for unit testing purposes)
- $moduleValues : array<string|int, mixed>|null
- Module values map
- $outputBase64 : bool
- Toggle base64 data URI or raw data output (if applicable)
- $outputInterface : string|null
- The FQCN of the custom QROutputInterface if $outputType is set to QRCode::OUTPUT_CUSTOM
- $outputType : string
- The built-in output type
- $quality : int
- Compression quality
- $quietzoneSize : int
- Size of the quiet zone
- $readerGrayscale : bool
- Grayscale the image before reading
- $readerIncreaseContrast : bool
- Increase the contrast before reading
- $readerUseImagickIfAvailable : bool
- Use Imagick (if available) when reading QR Codes
- $returnResource : bool
- Return the image resource instead of a render if applicable.
- $scale : int
- Pixel size of a QR code module
- $svgAddXmlHeader : bool
- Whether to add an XML header line or not, e.g. to embed the SVG directly in HTML
- $svgDefs : string
- Anything in the <defs> tag
- $svgHeight : string|null
- Optional "height" attribute with the specified value (note that the value is not checked!)
- $svgOpacity : float
- SVG opacity
- $svgPreserveAspectRatio : string
- $svgViewBoxSize : int|null
- SVG viewBox size. A single integer number which defines width/height of the viewBox attribute.
- $svgWidth : string|null
- Optional "width" attribute with the specified value (note that the value is not checked!)
- $textDark : string
- String substitute for dark
- $textLight : string
- String substitute for light
- $textLineStart : string
- An optional line prefix, e.g. empty space to align the QR Code in a console
- $transparencyColor : mixed|null
- Sets a transparency color for when {@see \chillerlan\QRCode\QROptions::$imageTransparent QROptions::$imageTransparent} is set to true.
- $version : int
- QR Code version number
- $versionMax : int
- Maximum QR version
- $versionMin : int
- Minimum QR version
Methods
- clampLogoSpaceValue() : int|null
- clamp the logo space values between 0 and maximum length (177 modules at version 40)
- get_imageBase64() : bool
- redirect call to the new variable
- get_imageTransparencyBG() : mixed
- get_imagickBG() : mixed
- get_jpegQuality() : int
- get_pngCompression() : int
- set_circleRadius() : void
- clamp/set SVG circle radius
- set_fpdfMeasureUnit() : void
- sets the FPDF measurement unit
- set_imageBase64() : void
- redirect call to the new variable
- set_imageTransparencyBG() : void
- set_imagickBG() : void
- set_jpegQuality() : void
- set_logoSpaceHeight() : void
- clamp/set logo space height
- set_logoSpaceStartX() : void
- clamp/set horizontal logo space start
- set_logoSpaceStartY() : void
- clamp/set vertical logo space start
- set_logoSpaceWidth() : void
- clamp/set logo space width
- set_pngCompression() : void
- set_quietzoneSize() : void
- sets/clamps the quiet zone size
- set_readerUseImagickIfAvailable() : void
- enables Imagick for the QR Code reader if the extension is available
- set_version() : void
- sets/clamps the version number
- set_versionMax() : void
- sets the maximum version number
- set_versionMin() : void
- sets the minimum version number
- setMinMaxVersion() : void
- clamp min/max version number
Properties
$addLogoSpace
Toggles logo space creation
protected
bool
$addLogoSpace
= false
$addQuietzone
Add a "quiet zone" (margin) according to the QR code spec
protected
bool
$addQuietzone
= true
Tags
$bgColor
Sets the image background color (if applicable)
protected
mixed|null
$bgColor
= null
- QRImagick: defaults to "white"
- QRGdImage: defaults to [255, 255, 255]
- QRFpdf: defaults to blank internally (white page)
$cachefile
Optional cache file path `/path/to/cache.file`
protected
string|null
$cachefile
= null
please note that the $file parameter in QRCode::render*() takes precedence over the $cachefile value
$circleRadius
Specifies the radius of the modules when $drawCircularModules is set to true
protected
float
$circleRadius
= 0.45
$connectPaths
Whether to connect the paths for the several module types to avoid weird glitches when using gradients etc.
protected
bool
$connectPaths
= false
Tags
$cssClass
A common css class
protected
string
$cssClass
= 'qrcode'
$drawCircularModules
Specify whether to draw the modules as filled circles
protected
bool
$drawCircularModules
= false
a note for GDImage output:
if QROptions::$scale is less than 20, the image will be upscaled internally, then the modules will be drawn using imagefilledellipse() and then scaled back to the expected size
No effect in: QREps, QRFpdf, QRMarkupHTML
Tags
$drawLightModules
Whether to draw the light (false) modules
protected
bool
$drawLightModules
= true
$eccLevel
Error correct level
protected
int
$eccLevel
= \chillerlan\QRCode\Common\EccLevel::L
QRCode::ECC_X where X is:
- L => 7%
- M => 15%
- Q => 25%
- H => 30%
Tags
$eol
Newline string
protected
string
$eol
= PHP_EOL
$excludeFromConnect
Specify which paths/patterns to exclude from connecting if $connectPaths is set to true
protected
array<string|int, mixed>
$excludeFromConnect
= []
$fpdfMeasureUnit
Measurement unit for FPDF output: pt, mm, cm, in (defaults to "pt")
protected
string
$fpdfMeasureUnit
= 'pt'
Tags
$imageBase64
protected
bool
$imageBase64
= true
Tags
$imageTransparent
Toggle transparency
protected
bool
$imageTransparent
= true
- QRGdImage and QRImagick: the given \chillerlan\QRCode\QROptions::$transparencyColor is set as transparent
Tags
$imagickFormat
Imagick output format
protected
string
$imagickFormat
= 'png32'
Tags
$jsonAsBooleans
Whether to return matrix values in JSON as booleans or $M_TYPE integers
protected
bool
$jsonAsBooleans
= false
$keepAsSquare
Specifies which module types to exclude when $drawCircularModules is set to true
protected
array<string|int, mixed>
$keepAsSquare
= []
$logoSpaceHeight
Height of the logo space
protected
int|null
$logoSpaceHeight
= null
if only either $logoSpaceWidth or $logoSpaceHeight is given, the logo space is assumed a square of that size
$logoSpaceStartX
Optional horizontal start position of the logo space (top left corner)
protected
int|null
$logoSpaceStartX
= null
$logoSpaceStartY
Optional vertical start position of the logo space (top left corner)
protected
int|null
$logoSpaceStartY
= null
$logoSpaceWidth
Width of the logo space
protected
int|null
$logoSpaceWidth
= null
if only either $logoSpaceWidth or $logoSpaceHeight is given, the logo space is assumed a square of that size
$markupDark
Markup substitute for dark (CSS value)
protected
string
$markupDark
= '#000'
$markupLight
Markup substitute for light (CSS value)
protected
string
$markupLight
= '#fff'
$maskPattern
Mask Pattern to use (no value in using, mostly for unit testing purposes)
protected
int
$maskPattern
= \chillerlan\QRCode\Common\MaskPattern::AUTO
[0...7] or MaskPattern::PATTERN_AUTO
$moduleValues
Module values map
protected
array<string|int, mixed>|null
$moduleValues
= null
- QRImagick, QRMarkupHTML, QRMarkupSVG: #ABCDEF, cssname, rgb(), rgba()...
- QREps, QRFpdf, QRGdImage: [R, G, B] // 0-255
- QREps: [C, M, Y, K] // 0-255
$outputBase64
Toggle base64 data URI or raw data output (if applicable)
protected
bool
$outputBase64
= true
$outputInterface
The FQCN of the custom QROutputInterface if $outputType is set to QRCode::OUTPUT_CUSTOM
protected
string|null
$outputInterface
= null
$outputType
The built-in output type
protected
string
$outputType
= \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG
- QROutputInterface::MARKUP_XXXX where XXXX = HTML, SVG
- QROutputInterface::GDIMAGE_XXX where XXX = BMP, GIF, JPG, PNG, WEBP
- QROutputInterface::STRING_XXXX where XXXX = TEXT, JSON
- QROutputInterface::IMAGICK
- QROutputInterface::EPS
- QROutputInterface::FPDF
- QROutputInterface::CUSTOM
$quality
Compression quality
protected
int
$quality
= -1
The given value depends on the used output type:
- GDIMAGE_BMP imagebmp() [0-1]
- GDIMAGE_JPG imagejpeg() [0-100]
- GDIMAGE_WEBP imagepng() [0-9]
- GDIMAGE_PNG imagewebp() [0-100]
- IMAGICK Imagick::setImageCompressionQuality() [0-100]
$quietzoneSize
Size of the quiet zone
protected
int
$quietzoneSize
= 4
internally clamped to [0 ... $moduleCount / 2], defaults to 4 modules
$readerGrayscale
Grayscale the image before reading
protected
bool
$readerGrayscale
= false
$readerIncreaseContrast
Increase the contrast before reading
protected
bool
$readerIncreaseContrast
= false
note that applying contrast works different in GD and Imagick, so mileage may vary
$readerUseImagickIfAvailable
Use Imagick (if available) when reading QR Codes
protected
bool
$readerUseImagickIfAvailable
= false
$returnResource
Return the image resource instead of a render if applicable.
protected
bool
$returnResource
= false
This option overrides/ignores other output options, such as $cachefile and $outputBase64.
Supported by the following modules:
- QRGdImage: resource (PHP < 8), GdImage
- QRImagick: Imagick
- QRFpdf: FPDF
Tags
$scale
Pixel size of a QR code module
protected
int
$scale
= 5
$svgAddXmlHeader
Whether to add an XML header line or not, e.g. to embed the SVG directly in HTML
protected
bool
$svgAddXmlHeader
= true
<?xml version="1.0" encoding="UTF-8"?>
$svgDefs
Anything in the <defs> tag
protected
string
$svgDefs
= ''
Tags
$svgHeight
Optional "height" attribute with the specified value (note that the value is not checked!)
protected
string|null
$svgHeight
= null
Tags
$svgOpacity
SVG opacity
protected
float
$svgOpacity
= 1.0
$svgPreserveAspectRatio
protected
string
$svgPreserveAspectRatio
= 'xMidYMid'
Tags
$svgViewBoxSize
SVG viewBox size. A single integer number which defines width/height of the viewBox attribute.
protected
int|null
$svgViewBoxSize
= null
viewBox="0 0 x x"
Tags
$svgWidth
Optional "width" attribute with the specified value (note that the value is not checked!)
protected
string|null
$svgWidth
= null
Tags
$textDark
String substitute for dark
protected
string
$textDark
= '██'
$textLight
String substitute for light
protected
string
$textLight
= '░░'
$textLineStart
An optional line prefix, e.g. empty space to align the QR Code in a console
protected
string
$textLineStart
= ''
$transparencyColor
Sets a transparency color for when {@see \chillerlan\QRCode\QROptions::$imageTransparent QROptions::$imageTransparent} is set to true.
protected
mixed|null
$transparencyColor
= null
Defaults to \chillerlan\QRCode\QROptions::$bgColor.
- QRGdImage: [R, G, B], this color is set as transparent in imagecolortransparent()
- QRImagick: "color_str", this color is set in Imagick::transparentPaintImage()
$version
QR Code version number
protected
int
$version
= \chillerlan\QRCode\Common\Version::AUTO
[1 ... 40] or Version::AUTO
$versionMax
Maximum QR version
protected
int
$versionMax
= 40
$versionMin
Minimum QR version
protected
int
$versionMin
= 1
if $version = QRCode::VERSION_AUTO
Methods
clampLogoSpaceValue()
clamp the logo space values between 0 and maximum length (177 modules at version 40)
protected
clampLogoSpaceValue(int|null $value) : int|null
Parameters
- $value : int|null
Return values
int|nullget_imageBase64()
redirect call to the new variable
protected
get_imageBase64() : bool
Tags
Return values
boolget_imageTransparencyBG()
protected
get_imageTransparencyBG() : mixed
Tags
get_imagickBG()
protected
get_imagickBG() : mixed
Tags
get_jpegQuality()
protected
get_jpegQuality() : int
Tags
Return values
intget_pngCompression()
protected
get_pngCompression() : int
Tags
Return values
intset_circleRadius()
clamp/set SVG circle radius
protected
set_circleRadius(float $circleRadius) : void
Parameters
- $circleRadius : float
set_fpdfMeasureUnit()
sets the FPDF measurement unit
protected
set_fpdfMeasureUnit(string $unit) : void
Parameters
- $unit : string
Tags
set_imageBase64()
redirect call to the new variable
protected
set_imageBase64(bool $imageBase64) : void
Parameters
- $imageBase64 : bool
Tags
set_imageTransparencyBG()
protected
set_imageTransparencyBG(array<string|int, mixed> $imageTransparencyBG) : void
Parameters
- $imageTransparencyBG : array<string|int, mixed>
Tags
set_imagickBG()
protected
set_imagickBG(string $imagickBG) : void
Parameters
- $imagickBG : string
Tags
set_jpegQuality()
protected
set_jpegQuality(int $jpegQuality) : void
Parameters
- $jpegQuality : int
Tags
set_logoSpaceHeight()
clamp/set logo space height
protected
set_logoSpaceHeight(int|null $value) : void
Parameters
- $value : int|null
set_logoSpaceStartX()
clamp/set horizontal logo space start
protected
set_logoSpaceStartX(int|null $value) : void
Parameters
- $value : int|null
set_logoSpaceStartY()
clamp/set vertical logo space start
protected
set_logoSpaceStartY(int|null $value) : void
Parameters
- $value : int|null
set_logoSpaceWidth()
clamp/set logo space width
protected
set_logoSpaceWidth(int|null $value) : void
Parameters
- $value : int|null
set_pngCompression()
protected
set_pngCompression(int $pngCompression) : void
Parameters
- $pngCompression : int
Tags
set_quietzoneSize()
sets/clamps the quiet zone size
protected
set_quietzoneSize(int $quietzoneSize) : void
Parameters
- $quietzoneSize : int
set_readerUseImagickIfAvailable()
enables Imagick for the QR Code reader if the extension is available
protected
set_readerUseImagickIfAvailable(bool $useImagickIfAvailable) : void
Parameters
- $useImagickIfAvailable : bool
set_version()
sets/clamps the version number
protected
set_version(int $version) : void
Parameters
- $version : int
set_versionMax()
sets the maximum version number
protected
set_versionMax(int $version) : void
Parameters
- $version : int
set_versionMin()
sets the minimum version number
protected
set_versionMin(int $version) : void
Parameters
- $version : int
setMinMaxVersion()
clamp min/max version number
protected
setMinMaxVersion(int $versionMin, int $versionMax) : void
Parameters
- $versionMin : int
- $versionMax : int