Skip to content

QROptionsTrait

The QRCode plug-in settings & setter functionality

  • Full name: \chillerlan\QRCode\QROptionsTrait

Properties

version

QR Code version number

protected int $version

[1 ... 40] or QRCode::VERSION_AUTO


versionMin

Minimum QR version

protected int $versionMin

if $version = QRCode::VERSION_AUTO


versionMax

Maximum QR version

protected int $versionMax

eccLevel

Error correct level

protected int $eccLevel

QRCode::ECC_X where X is:

  • L => 7%
  • M => 15%
  • Q => 25%
  • H => 30%

maskPattern

Mask Pattern to use

protected int $maskPattern

[0...7] or QRCode::MASK_PATTERN_AUTO


addQuietzone

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

protected bool $addQuietzone

quietzoneSize

Size of the quiet zone

protected int $quietzoneSize

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.

protected string $dataModeOverride

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

protected string $outputType
  • 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

protected ?string $outputInterface

cachefile

/path/to/cache.file

protected ?string $cachefile

eol

newline string [HTML, SVG, TEXT]

protected string $eol

scale

size of a QR code pixel [SVG, IMAGE_*], HTML via CSS

protected int $scale

cssClass

a common css class

protected string $cssClass

svgOpacity

SVG opacity

protected float $svgOpacity

svgDefs

anything between

protected string $svgDefs

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.

protected ?int $svgViewBoxSize

viewBox="0 0 x x"

See Also:

  • https://css-tricks.com/scale-svg/#article-header-id-3 -

textDark

string substitute for dark

protected string $textDark

textLight

string substitute for light

protected string $textLight

markupDark

markup substitute for dark (CSS value)

protected string $markupDark

markupLight

markup substitute for light (CSS value)

protected string $markupLight

returnResource

Return the image resource instead of a render if applicable.

protected bool $returnResource

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

protected bool $imageBase64

imageTransparent

toggle transparency, not supported by jpg

protected bool $imageTransparent

imageTransparencyBG

protected array $imageTransparencyBG

See Also:

  • \chillerlan\QRCode\imagecolortransparent() - [R, G, B]

pngCompression

protected int $pngCompression

See Also:

  • \chillerlan\QRCode\imagepng() -

jpegQuality

protected int $jpegQuality

See Also:

  • \chillerlan\QRCode\imagejpeg() -

imagickFormat

Imagick output format

protected string $imagickFormat

See Also:

  • \Imagick::setType() -

imagickBG

Imagick background color (defaults to "transparent")

protected ?string $imagickBG

See Also:

  • \ImagickPixel::__construct() -

fpdfMeasureUnit

Measurement unit for FPDF output: pt, mm, cm, in (defaults to "pt")

protected string $fpdfMeasureUnit

See Also:

  • \FPDF::__construct() -

moduleValues

Module values map

protected ?array $moduleValues
  • HTML, IMAGICK: #ABCDEF, cssname, rgb(), rgba()...
  • IMAGE: [63, 127, 255] // R, G, B

Methods

setMinMaxVersion

clamp min/max version number

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

Parameters:

Parameter Type Description
$versionMin int
$versionMax int

set_versionMin

sets the minimum version number

protected set_versionMin(int $version): void

Parameters:

Parameter Type Description
$version int

set_versionMax

sets the maximum version number

protected set_versionMax(int $version): void

Parameters:

Parameter Type Description
$version int

set_eccLevel

sets the error correction level

protected set_eccLevel(int $eccLevel): void

Parameters:

Parameter Type Description
$eccLevel int

Throws:


set_maskPattern

sets/clamps the mask pattern

protected set_maskPattern(int $maskPattern): void

Parameters:

Parameter Type Description
$maskPattern int

set_imageTransparencyBG

sets the transparency background color

protected set_imageTransparencyBG(array $imageTransparencyBG): void

Parameters:

Parameter Type Description
$imageTransparencyBG array

Throws:


set_version

sets/clamps the version number

protected set_version(int $version): void

Parameters:

Parameter Type Description
$version int

set_fpdfMeasureUnit

sets the FPDF measurement unit

protected set_fpdfMeasureUnit(string $unit): void

Parameters:

Parameter Type Description
$unit string


Automatically generated on 2025-03-18