Table of contents
Namespace: Com\Tecnick\Barcode\Type\Square\QrCode
Extends: Compaction
File: Encode.php line 38
Symbol builder for the QrCode Barcode type class, sections 7.5 to 7.10 of ISO/IEC 18004.
Tags
- since: 2026-09-02
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2015-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-barcode
Constants
MASKS
File: Encode.php line 45
public int MASKS = 8
MAX_CHARACTERS
File: Encode.php line 53
public int MAX_CHARACTERS = 7089
Methods
__construct()
File: Encode.php line 131
public __construct(string $code, int $level, int $version, bool $kanji[, int $randomMask = -1 ][, bool $bestMask = true ][, int $defaultMask = 2 ]) : mixed
Parameters
- $code : string: Code to encode.
- $level : int: Error correction level, from 0 to 3.
- $version : int: Requested version, from 1 to 40, or 0 for the smallest version that carries the code.
- $kanji : bool: Whether the kanji mode may be used.
- $randomMask : int = -1: Number of randomly chosen masks to evaluate, or a negative value to evaluate every mask.
- $bestMask : bool = true: Whether to evaluate the masks at all.
- $defaultMask : int = 2: Mask applied when the masks are not evaluated.
Tags
- throws: Exception in case of error
- throws: RandomException in case of random generation error
getDataCodewords()
File: Encode.php line 181
public static getDataCodewords(int $version, int $level) : int
Parameters
- $version : int: Symbol version.
- $level : int: Error correction level.
Return values
int
getEncodingModules()
File: Encode.php line 217
public static getEncodingModules(int $version) : int
Parameters
- $version : int: Symbol version.
Return values
int
getGrid()
File: Encode.php line 155
public getGrid() : array<int, string>
Return values
array<int, string>
getRemainderBits()
File: Encode.php line 205
public static getRemainderBits(int $version) : int
Parameters
- $version : int: Symbol version.
Return values
int
getTotalCodewords()
File: Encode.php line 194
public static getTotalCodewords(int $version) : int
Parameters
- $version : int: Symbol version.
Return values
int
getVersion()
File: Encode.php line 168
public getVersion() : int
Return values
int