# QROptions
(via `QROptionsTrait`)

The full phpDocumentor API documentation can be found at [chillerlan.github.io/php-qrcode](https://chillerlan.github.io/php-qrcode/classes/chillerlan-QRCode-QROptions.html).


## Methods

Inherited from [`SettingsContainerAbstract`](https://github.com/chillerlan/php-settings-container/blob/main/src/SettingsContainerAbstract.php)
<!-- using non-breaking spaces chr(255) in the longest method signature to force the silly table to stretch -->
| method                                     | return                       | info                                                                                                            |
|--------------------------------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------|
| `__construct(iterable $properties = null)` | -                            | calls `construct()` internally after the properties have been set                                               |
| (protected) `construct()`                  | `void`                       | calls a method with trait name as replacement constructor for each used trait (similar to PHP4 constructors)    |
| `__get(string $property)`                  | `mixed`                      | calls `$this->{'get_'.$property}()` if such a method exists                                                     |
| `__set(string $property, $value)`          | `void`                       | calls `$this->{'set_'.$property}($value)` if such a method exists                                               |
| `__isset(string $property)`                | `bool`                       |                                                                                                                 |
| `__unset(string $property)`                | `void`                       |                                                                                                                 |
| `__toString()`                             | `string`                     | a JSON string                                                                                                   |
| `toArray()`                                | `array`                      |                                                                                                                 |
| `fromIterable(iterable $properties)`       | `SettingsContainerInterface` |                                                                                                                 |
| `toJSON(int $jsonOptions = null)`          | `string`                     | accepts [JSON options constants](http://php.net/manual/json.constants.php)                                      |
| `fromJSON(string $json)`                   | `SettingsContainerInterface` |                                                                                                                 |
| `jsonSerialize()`                          | `mixed`                      | implements the [`JsonSerializable`](https://www.php.net/manual/en/jsonserializable.jsonserialize.php) interface |


## Properties

| property                       | type           | default                         | allowed                                 | description                                                                                                                                                                             |
|--------------------------------|----------------|---------------------------------|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `$version`                     | `int`          | `Version::AUTO`                 | `1...40`, `Version::AUTO`               | [QR Code version number](http://www.qrcode.com/en/about/version.html)                                                                                                                   |
| `$versionMin`                  | `int`          | `1`                             | `1...40`                                | Minimum QR version (if `$version = QRCode::VERSION_AUTO`)                                                                                                                               |
| `$versionMax`                  | `int`          | `40`                            | `1...40`                                | Maximum QR version (if `$version = QRCode::VERSION_AUTO`)                                                                                                                               |
| `$eccLevel`                    | `int`          | `EccLevel::L`                   | `EccLevel::X`                           | Error correct level, where X = L (7%), M (15%), Q (25%), H (30%)                                                                                                                        |
| `$maskPattern`                 | `int`          | `MaskPattern::AUTO`             | `0...7`, `MaskPattern::AUTO`            | Mask Pattern to use                                                                                                                                                                     |
| `$addQuietzone`                | `bool`         | `true`                          | *                                       | Add a "quiet zone" (margin) according to the QR code spec                                                                                                                               |
| `$quietzoneSize`               | `int`          | `4`                             | clamped to `0...($matrixSize / 2)`      | Size of the quiet zone                                                                                                                                                                  |
| `$outputType`                  | `string`       | `QROutputInterface::MARKUP_SVG` | `QROutputInterface::XXX`                | The built-in output type, XXX can be one of: `MARKUP_HTML`, `MARKUP_SVG`, `GDIMAGE_PNG`, `GDIMAGE_JPG`, `GDIMAGE_GIF`, `STRING_TEXT`, `STRING_JSON`, `IMAGICK`, `EPS`, `FPDF`, `CUSTOM` |
| `$outputInterface`             | `string\|null` | `null`                          | *                                       | The FQCN of the custom `QROutputInterface` if `QROptions::$outputType` is set to `QROutputInterface::CUSTOM`                                                                            |
| `$returnResource`              | `bool`         | `false`                         | *                                       | Return the image resource instead of a render if applicable.                                                                                                                            |
| `$cachefile`                   | `string\|null` | `null`                          | *                                       | Optional cache file path                                                                                                                                                                |
| `$outputBase64`                | `bool`         | `true`                          | *                                       | Toggle base64 data URI or raw data output (if applicable)                                                                                                                               |
| `$eol`                         | `string`       | `PHP_EOL`                       | *                                       | Newline string (HTML, SVG, TEXT)                                                                                                                                                        |
| `$bgColor`                     | `mixed`        | `null`                          | a valid FPDF, GD or Imagick color value | Sets the image background color (if applicable). QRImagick: defaults to "white", QRGdImage: defaults to [255, 255, 255], QRFpdf: defaults to blank internally (white page)              |
| `$drawLightModules`            | `bool`         | `true`                          | *                                       | Whether to draw the light (false) modules                                                                                                                                               |
| `$drawCircularModules`         | `bool`         | `false`                         | *                                       | Specify whether to draw the modules as filled circles                                                                                                                                   |
| `$circleRadius`                | `float`        | `0.45`                          | `0.1...0.75`                            | Specifies the radius of the modules when $svgDrawCircularModules is set to true                                                                                                         |
| `$keepAsSquare`                | `array`        | `[]`                            | `int[]`                                 | Specifies which module types to exclude when $svgDrawCircularModules is set to true                                                                                                     |
| `$connectPaths`                | `bool`         | `false`                         | *                                       | Whether to connect the paths for the several module types to avoid weird glitches when using gradients etc.                                                                             |
| `$excludeFromConnect`          | `array`        | `[]`                            | `int[]`                                 | Specify which paths/patterns to exclude from connecting if $svgConnectPaths is set to true                                                                                              |
| `$moduleValues`                | `array\|null`  | `null`                          | *                                       | Module values map, see [[Custom module values]]                                                                                                                                         |
| `$addLogoSpace`                | `bool`         | `false`                         | *                                       | Toggles logo space creation                                                                                                                                                             |
| `$logoSpaceWidth`              | `int\|null`    | `null`                          | *                                       | Width of the logo space                                                                                                                                                                 |
| `$logoSpaceHeight`             | `int\|null`    | `null`                          | *                                       | Height of the logo space                                                                                                                                                                |
| `$logoSpaceStartX`             | `int\|null`    | `null`                          | *                                       | Optional horizontal start position of the logo space (top left corner)                                                                                                                  |
| `$logoSpaceStartY`             | `int\|null`    | `null`                          | *                                       | Optional vertical start position of the logo space (top left corner)                                                                                                                    |
| `$scale`                       | `int`          | `5`                             | *                                       | Pixel size of a QR code module                                                                                                                                                          |
| `$imageTransparent`            | `bool`         | `true`                          | *                                       | Toggle transparency (no jpeg support), QRGdImage and QRImagick only. The given `QROptions::$transparencyColor` is set as transparent                                                    |
| `$transparencyColor`           | `mixed`        | `null`                          | a valid GD or Imagick color value       | Sets a transparency color for when `QROptions::$imageTransparent` is set to true. Defaults to `QROptions::$bgColor`.                                                                    |
| `$quality`                     | `int`          | `-1`                            | *                                       | compression quality setting for `imagejpeg()`, `imagepng()`, `imagewebp()`, `Imagick::setImageCompressionQuality()`                                                                     |
| `$imagickFormat`               | `string`       | `'png'`                         | *                                       | ImageMagick output type, see `Imagick::setType()`                                                                                                                                       |
| `$cssClass`                    | `string`       | `'qrcode'`                      | *                                       | A common css class                                                                                                                                                                      |
| `$markupDark`                  | `string`       | `'#000'`                        | *                                       | Markup substitute for dark (CSS value)                                                                                                                                                  |
| `$markupLight`                 | `string`       | `'#fff'`                        | *                                       | Markup substitute for light (CSS value)                                                                                                                                                 |
| `$svgAddXmlHeader`             | `bool`         | `true`                          | *                                       | Whether to add an XML header line or not, e.g. to embed the SVG directly in HTML                                                                                                        |
| `$svgOpacity`                  | `float`        | `1.0`                           | `0...1`                                 | SVG opacity                                                                                                                                                                             |
| `$svgDefs`                     | `string`       | `''`                            | *                                       | Anything in the [`<defs>`](https://developer.mozilla.org/docs/Web/SVG/Element/defs) tag                                                                                                 |
| `$svgViewBoxSize`              | `int\|null`    | `null`                          | *                                       | SVG viewBox size. A single integer number which defines width/height of the [viewBox attribute](https://css-tricks.com/scale-svg/#article-header-id-3) `viewBox="0 0 x x"`.             |
| `$svgPreserveAspectRatio`      | `string`       | `'xMidYMid'`                    | *                                       | See [preserveAspectRatio on MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio)                                                                        |
| `$svgWidth`                    | `string\|null` | `null`                          | *                                       | Optional "width" attribute with the specified value (note that the value is not checked!)                                                                                               |
| `$svgHeight`                   | `string\|null` | `null`                          | *                                       | Optional "height" 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                                                                                                             |
| `$jsonAsBooleans`              | `bool`         | `false`                         | *                                       | Whether to return matrix values in JSON as booleans or $M_TYPE integers                                                                                                                 |
| `$fpdfMeasureUnit`             | `string`       | `'pt'`                          | *                                       | Measurement unit for FPDF output: pt, mm, cm, in                                                                                                                                        |
| `$readerUseImagickIfAvailable` | `bool`         | `false`                         | *                                       | Use Imagick (if available) when reading QR Codes                                                                                                                                        |
| `$readerGrayscale`             | `bool`         | `false`                         | *                                       | Grayscale the image before reading                                                                                                                                                      |
| `$readerIncreaseContrast`      | `bool`         | `false`                         | *                                       | Increase the contrast before reading                                                                                                                                                    |
