# Documentation

Menu

## QROptionsTrait

QROptionsTrait.php : 68

The QRCode plug-in settings & setter functionality

### 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
  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 `QROptions::$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, int>
  Specify which paths/patterns to exclude from connecting if `QROptions::$connectPaths` is set to `true`
$fpdfMeasureUnit : string
  Measurement unit for `FPDF` output: `pt`, `mm`, `cm`, `in` (default: `pt`)
$gdImageUseUpscale : bool
  Toggles the usage of internal upscaling when `QROptions::$drawCircularModules` is set to `true` and `QROptions::$scale` is less than 20
$imageTransparent : bool
  Toggle transparency
$imagickFormat : string
  Imagick output format
$invertMatrix : bool
  Whether to invert the matrix (reflectance reversal)
$jsonFlags : int
  Sets the flags to use for the `json_encode()` call
$keepAsSquare : array<string|int, int>
  Specifies which module types to exclude when `QROptions::$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
$maskPattern : int
  Mask Pattern to use (no value in using, mostly for unit testing purposes)
$moduleValues : array<int, mixed>
  Module values map
$outputBase64 : bool
  Toggle base64 data URI or raw data output (if applicable)
$outputInterface : string
  The FQCN of the `QROutputInterface` to use
$quality : int
  Compression quality
$quietzoneSize : int
  Size of the quiet zone
$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 SVG `<defs>` tag
$svgPreserveAspectRatio : string
  Sets the value for the "preserveAspectRatio" on the `<svg>` element
$svgUseFillAttributes : bool
  Whether to use the SVG `fill` attributes
$textLineStart : string
  An optional line prefix, e.g. empty space to align the QR Code in a console
$transparencyColor : mixed
  Sets a transparency color for when `QROptions::$imageTransparent` is set to `true`.
$version : int
  QR Code version number
$versionMax : int
  Maximum QR version
$versionMin : int
  Minimum QR version
$xmlStylesheet : string|null
  Sets an optional XSLT stylesheet in the XML output

#### Methods

clampLogoSpaceValue() : int|null
  clamp the logo space values between 0 and maximum length (177 modules at version 40)
set_circleRadius() : void
  clamp/set SVG circle radius
set_eccLevel() : void
  sets the ECC level
set_fpdfMeasureUnit() : void
  sets the FPDF measurement unit
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_quietzoneSize() : void
  sets/clamps the quiet zone size
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

QROptionsTrait.php : 294

Toggles logo space creation

`protected bool $addLogoSpace = false`

##### Tags

see
  QRCode::addMatrixModifications()
see
  QRMatrix::setLogoSpace()

#### $addQuietzone

QROptionsTrait.php : 128

Add a "quiet zone" (margin) according to the QR code spec

`protected bool $addQuietzone = true`

##### Tags

see
  https://www.qrcode.com/en/howto/code.html

#### $bgColor

QROptionsTrait.php : 200

Sets the image background color (if applicable)

`protected mixed $bgColor = null`

- `QRImagick`: defaults to `"white"`
- `QRGdImage`: defaults to `[255, 255, 255]`
- `QRFpdf`: defaults to blank internally (white page)

#### $cachefile

QROptionsTrait.php : 170

Optional cache file path `/path/to/cache.file`

`protected string|null $cachefile = null`

Please note that the `$file` parameter in `QRCode::render()` and `QRCode::renderMatrix()` takes precedence over the `QROptions::$cachefile` value. (default: `null`)

##### Tags

see
  QRCode::render()
see
  QRCode::renderMatrix()

#### $circleRadius

QROptionsTrait.php : 239

Specifies the radius of the modules when `QROptions::$drawCircularModules` is set to `true`

`protected float $circleRadius = 0.45`

(default: 0.45)

#### $connectPaths

QROptionsTrait.php : 264

Whether to connect the paths for the several module types to avoid weird glitches when using gradients etc.

`protected bool $connectPaths = false`

This option is exclusive to output classes that use the module collector `QROutputAbstract::collectModules()`, which converts the `$M_TYPE` of all modules to `QRMatrix::M_DATA` and `QRMatrix::M_DATA_DARK` respectively.

Module types that should not be added to the connected path can be excluded via `QROptions::$excludeFromConnect`.

Currentty used in `QREps` and `QRMarkupSVG`.

##### Tags

see
  QROutputAbstract::collectModules()
see
  QROptionsTrait::$excludeFromConnect
see
  https://github.com/chillerlan/php-qrcode/issues/57

#### $cssClass

QROptionsTrait.php : 406

A common css class

`protected string $cssClass = 'qrcode'`

#### $drawCircularModules

QROptionsTrait.php : 232

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

see
  imagefilledellipse()
see
  https://github.com/chillerlan/php-qrcode/issues/23
see
  https://github.com/chillerlan/php-qrcode/discussions/122

#### $drawLightModules

QROptionsTrait.php : 216

Whether to draw the light (false) modules

`protected bool $drawLightModules = true`

(default: `true`)

#### $eccLevel

QROptionsTrait.php : 112

Error correct level

`protected int $eccLevel = \chillerlan\QRCode\Common\EccLevel::L`

the constant `EccLevel::X` where `X` is:

- `L` => 7% (default)
- `M` => 15%
- `Q` => 25%
- `H` => 30%

alternatively you can just pass the letters L/M/Q/H (case-insensitive) to the magic setter

##### Tags

see
  EccLevel
see
  https://github.com/chillerlan/php-qrcode/discussions/160

#### $eol

QROptionsTrait.php : 186

Newline string

`protected string $eol = \PHP_EOL`

(default: `PHP_EOL`)

#### $excludeFromConnect

QROptionsTrait.php : 273

Specify which paths/patterns to exclude from connecting if `QROptions::$connectPaths` is set to `true`

`protected array<string|int, int> $excludeFromConnect = []`

##### Tags

see
  QROptionsTrait::$connectPaths

#### $fpdfMeasureUnit

QROptionsTrait.php : 476

Measurement unit for `FPDF` output: `pt`, `mm`, `cm`, `in` (default: `pt`)

`protected string $fpdfMeasureUnit = 'pt'`

##### Tags

see
  FPDF::__construct()

#### $gdImageUseUpscale

QROptionsTrait.php : 383

Toggles the usage of internal upscaling when `QROptions::$drawCircularModules` is set to `true` and `QROptions::$scale` is less than 20

`protected bool $gdImageUseUpscale = true`

##### Tags

see
  QRGdImage::createImage()
see
  https://github.com/chillerlan/php-qrcode/issues/23

#### $imageTransparent

QROptionsTrait.php : 337

Toggle transparency

`protected bool $imageTransparent = false`

- `QRGdImage` and `QRImagick`: the given `QROptions::$transparencyColor` is set as transparent

##### Tags

see
  https://github.com/chillerlan/php-qrcode/discussions/121

#### $imagickFormat

QROptionsTrait.php : 396

Imagick output format

`protected string $imagickFormat = 'png32'`

##### Tags

see
  Imagick::setImageFormat()
see
  https://www.imagemagick.org/script/formats.php

#### $invertMatrix

QROptionsTrait.php : 209

Whether to invert the matrix (reflectance reversal)

`protected bool $invertMatrix = false`

(default: `false`)

##### Tags

see
  QRMatrix::invert()

#### $jsonFlags

QROptionsTrait.php : 464

Sets the flags to use for the `json_encode()` call

`protected int $jsonFlags = \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_SLASHES`

##### Tags

see
  https://www.php.net/manual/json.constants.php

#### $keepAsSquare

QROptionsTrait.php : 248

Specifies which module types to exclude when `QROptions::$drawCircularModules` is set to `true`

`protected array<string|int, int> $keepAsSquare = []`

(default: `[]`)

#### $logoSpaceHeight

QROptionsTrait.php : 308

Height of the logo space

`protected int|null $logoSpaceHeight = null`

if only `QROptions::$logoSpaceHeight` is given, the logo space is assumed a square of that size

#### $logoSpaceStartX

QROptionsTrait.php : 313

Optional horizontal start position of the logo space (top left corner)

`protected int|null $logoSpaceStartX = null`

#### $logoSpaceStartY

QROptionsTrait.php : 318

Optional vertical start position of the logo space (top left corner)

`protected int|null $logoSpaceStartY = null`

#### $logoSpaceWidth

QROptionsTrait.php : 301

Width of the logo space

`protected int|null $logoSpaceWidth = null`

if only `QROptions::$logoSpaceWidth` is given, the logo space is assumed a square of that size

#### $maskPattern

QROptionsTrait.php : 121

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` (default)

##### Tags

see
  MaskPattern

#### $moduleValues

QROptionsTrait.php : 286

Module values map

`protected array<int, mixed> $moduleValues = []`

- `QRImagick`, `QRMarkupHTML`, `QRMarkupSVG`: #ABCDEF, cssname, rgb(), rgba()...
- `QREps`, `QRFpdf`, `QRGdImage`: `[R, G, B]` // 0-255
- `QREps`: `[C, M, Y, K]` // 0-255

##### Tags

see
  QROutputAbstract::setModuleValues()

#### $outputBase64

QROptionsTrait.php : 179

Toggle base64 data URI or raw data output (if applicable)

`protected bool $outputBase64 = true`

(default: `true`)

##### Tags

see
  QROutputAbstract::toBase64DataURI()

#### $outputInterface

QROptionsTrait.php : 145

The FQCN of the `QROutputInterface` to use

`protected string $outputInterface = \chillerlan\QRCode\Output\QRMarkupSVG::class`

#### $quality

QROptionsTrait.php : 369

Compression quality

`protected int $quality = -1`

The given value depends on the used output type:

- `QRGdImageBMP`: `[0...1]`
- `QRGdImageJPEG`: `[0...100]`
- `QRGdImageWEBP`: `[0...9]`
- `QRGdImagePNG`: `[0...100]`
- `QRImagick`: `[0...100]`

##### Tags

see
  imagebmp()
see
  imagejpeg()
see
  imagepng()
see
  imagewebp()
see
  Imagick::setImageCompressionQuality()

#### $quietzoneSize

QROptionsTrait.php : 135

Size of the quiet zone

`protected int $quietzoneSize = 4`

internally clamped to `0 ... $moduleCount / 2` (default: 4)

#### $returnResource

QROptionsTrait.php : 159

Return the image resource instead of a render if applicable.

`protected bool $returnResource = false`

- `QRGdImage`: `resource` (PHP < 8), `GdImage`
- `QRImagick`: `Imagick`
- `QRFpdf`: `FPDF`

This option overrides/ignores other output settings, such as `QROptions::$cachefile` and `QROptions::$outputBase64`. (default: `false`)

##### Tags

see
  QROutputInterface::dump()

#### $scale

QROptionsTrait.php : 328

Pixel size of a QR code module

`protected int $scale = 5`

#### $svgAddXmlHeader

QROptionsTrait.php : 418

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

QROptionsTrait.php : 425

Anything in the SVG `<defs>` tag

`protected string $svgDefs = ''`

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs

#### $svgPreserveAspectRatio

QROptionsTrait.php : 432

Sets the value for the "preserveAspectRatio" on the `<svg>` element

`protected string $svgPreserveAspectRatio = 'xMidYMid'`

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio

#### $svgUseFillAttributes

QROptionsTrait.php : 442

Whether to use the SVG `fill` attributes

`protected bool $svgUseFillAttributes = true`

If set to `true` (default), the `fill` attribute will be set with the module value for the `<path>` element's `$M_TYPE`. When set to `false`, the module values map will be ignored and the QR Code may be styled via CSS.

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill

#### $textLineStart

QROptionsTrait.php : 452

An optional line prefix, e.g. empty space to align the QR Code in a console

`protected string $textLineStart = ''`

#### $transparencyColor

QROptionsTrait.php : 350

Sets a transparency color for when `QROptions::$imageTransparent` is set to `true`.

`protected mixed $transparencyColor = null`

Defaults to `QROptions::$bgColor`.

- `QRGdImage`: `[R, G, B]`, this color is set as transparent in `imagecolortransparent()`
- `QRImagick`: `"color_str"`, this color is set in `Imagick::transparentPaintImage()`

##### Tags

see
  imagecolortransparent()
see
  Imagick::transparentPaintImage()

#### $version

QROptionsTrait.php : 81

QR Code version number

`protected int $version = \chillerlan\QRCode\Common\Version::AUTO`

`1 ... 40` or `Version::AUTO` (default)

##### Tags

see
  Version

#### $versionMax

QROptionsTrait.php : 95

Maximum QR version

`protected int $versionMax = 40`

if `QROptions::$version` is set to `Version::AUTO` (default: 40)

#### $versionMin

QROptionsTrait.php : 88

Minimum QR version

`protected int $versionMin = 1`

if `QROptions::$version` is set to `Version::AUTO` (default: 1)

#### $xmlStylesheet

QROptionsTrait.php : 488

Sets an optional XSLT stylesheet in the XML output

`protected string|null $xmlStylesheet = null`

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/XSLT

### Methods

#### clampLogoSpaceValue()

QROptionsTrait.php : 575

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|null

#### set_circleRadius()

QROptionsTrait.php : 615

clamp/set SVG circle radius

`protected set_circleRadius(float $circleRadius) : void`

##### Parameters

$circleRadius : float

#### set_eccLevel()

QROptionsTrait.php : 528

sets the ECC level

`protected set_eccLevel(int|string $eccLevel) : void`

##### Parameters

$eccLevel : int|string

##### Tags

throws
  QRCodeException

#### set_fpdfMeasureUnit()

QROptionsTrait.php : 562

sets the FPDF measurement unit

`protected set_fpdfMeasureUnit(string $unit) : void`

##### Parameters

$unit : string

##### Tags

codeCoverageIgnore

#### set_logoSpaceHeight()

QROptionsTrait.php : 594

clamp/set logo space height

`protected set_logoSpaceHeight(int|null $value) : void`

##### Parameters

$value : int|null

#### set_logoSpaceStartX()

QROptionsTrait.php : 601

clamp/set horizontal logo space start

`protected set_logoSpaceStartX(int|null $value) : void`

##### Parameters

$value : int|null

#### set_logoSpaceStartY()

QROptionsTrait.php : 608

clamp/set vertical logo space start

`protected set_logoSpaceStartY(int|null $value) : void`

##### Parameters

$value : int|null

#### set_logoSpaceWidth()

QROptionsTrait.php : 587

clamp/set logo space width

`protected set_logoSpaceWidth(int|null $value) : void`

##### Parameters

$value : int|null

#### set_quietzoneSize()

QROptionsTrait.php : 553

sets/clamps the quiet zone size

`protected set_quietzoneSize(int $quietzoneSize) : void`

##### Parameters

$quietzoneSize : int

#### set_version()

QROptionsTrait.php : 519

sets/clamps the version number

`protected set_version(int $version) : void`

##### Parameters

$version : int

#### set_versionMax()

QROptionsTrait.php : 512

sets the maximum version number

`protected set_versionMax(int $version) : void`

##### Parameters

$version : int

#### set_versionMin()

QROptionsTrait.php : 505

sets the minimum version number

`protected set_versionMin(int $version) : void`

##### Parameters

$version : int

#### setMinMaxVersion()

QROptionsTrait.php : 494

clamp min/max version number

`protected setMinMaxVersion(int $versionMin, int $versionMax) : void`

##### Parameters

$versionMin : int
$versionMax : int

## Search results