Skip to main content
Every method documented here returns a cloned Generator instance, keeping the original state intact. Chain as many calls as you need before calling generate() or any data-type method to produce your final QrCodeResult.

style()

Set the shape used to draw each QR module (the individual dots that make up the code).
string
required
The module style. Accepted values:
float
Optional scaling factor for the module size, between 0.0 and 1.0. Useful with dot style to add spacing between dots. Defaults to the renderer’s built-in size.

eye()

Set the style of the three outer finder-pattern squares (the large corner squares that help scanners locate the code).
string
required
Accepted values:

internalEye()

Set the style of the three inner finder-pattern squares independently of the outer eye. Use this together with eye() to create composite eye designs.
string
required
Accepted values: square, circle, pointy — same as eye().

eyeColor()

Override the color of a single finder-pattern eye. Call this method up to three times to style each eye independently.
Requires the ext-imagick PHP extension for raster output (PNG). The GD fallback does not support per-eye colors and will throw a MissingExtensionException if eyeColor() is used without Imagick. SVG and EPS output work without Imagick.
int
required
The index of the eye to color. Accepted values: 0, 1, 2 (top-left, top-right, bottom-left respectively).
string | array
required
Color for the inner square of the eye. Pass a hex string (e.g. '#e11d48') or an RGB array (e.g. [225, 29, 72]).
string | array | null
Color for the outer ring of the eye. Accepts the same formats as inner. When null, the outer ring inherits the global foreground color set by color().

size()

Set the output image width and height in pixels. The QR code is always square.
int
required
Pixel dimensions for both width and height. The default from the package config is 400.

margin()

Set the quiet-zone margin — the blank border surrounding the QR code. A margin of at least 4 modules is recommended by the QR specification for reliable scanning.
int
required
Margin thickness in pixels. The package default is 4.

format()

Set the output image format.
string
required
Accepted values:

encoding()

Set the character encoding used when converting the text payload to QR code data. The default is UTF-8, which handles most use cases including multibyte characters.
string
required
Any valid PHP character encoding string, such as UTF-8, ISO-8859-1, or Shift_JIS.

errorCorrection()

Set the Reed–Solomon error correction level. Higher correction means the QR code can recover from more physical damage or obstruction, but also produces a denser, larger code for the same payload.
string
required
Accepted values:
Use H error correction when you overlay a logo using merge() or mergeString(). The extra redundancy ensures scanners can still read the code even though part of it is covered.

Full styling example