QRCode
in package
Turns a text string into a Model 2 QR Code
Tags
Table of Contents
Constants
- ECC_H = \chillerlan\QRCode\Common\EccLevel::H
- ECC_L = \chillerlan\QRCode\Common\EccLevel::L
- ECC_M = \chillerlan\QRCode\Common\EccLevel::M
- ECC_Q = \chillerlan\QRCode\Common\EccLevel::Q
- MASK_PATTERN_AUTO = \chillerlan\QRCode\Common\MaskPattern::AUTO
- OUTPUT_CUSTOM = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM
- OUTPUT_EPS = \chillerlan\QRCode\Output\QROutputInterface::EPS
- OUTPUT_FPDF = \chillerlan\QRCode\Output\QROutputInterface::FPDF
- OUTPUT_IMAGE_GIF = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF
- OUTPUT_IMAGE_JPG = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG
- OUTPUT_IMAGE_PNG = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG
- OUTPUT_IMAGICK = \chillerlan\QRCode\Output\QROutputInterface::IMAGICK
- OUTPUT_MARKUP_HTML = \chillerlan\QRCode\Output\QROutputInterface::MARKUP_HTML
- OUTPUT_MARKUP_SVG = \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG
- OUTPUT_MODES = \chillerlan\QRCode\Output\QROutputInterface::MODES
- OUTPUT_STRING_JSON = \chillerlan\QRCode\Output\QROutputInterface::STRING_JSON
- OUTPUT_STRING_TEXT = \chillerlan\QRCode\Output\QROutputInterface::STRING_TEXT
- VERSION_AUTO = \chillerlan\QRCode\Common\Version::AUTO
Properties
- $dataSegments : array<string|int, QRDataModeInterface>
- A collection of one or more data segments of QRDataModeInterface instances to write
- $luminanceSourceFQN : string
- The luminance source for the reader
- $options : QROptions|SettingsContainerInterface
- The settings container
Methods
- __construct() : mixed
- QRCode constructor.
- addAlphaNumSegment() : self
- Adds an alphanumeric data segment
- addByteSegment() : self
- Adds an 8-bit byte data segment
- addEciDesignator() : self
- Adds a standalone ECI designator
- addEciSegment() : self
- Adds an ECI data segment (including designator)
- addHanziSegment() : self
- Adds a Hanzi data segment (simplified Chinese 13-bit double-byte characters, GB2312/GB18030)
- addKanjiSegment() : self
- Adds a Kanji data segment (Japanese 13-bit double-byte characters, Shift-JIS)
- addNumericSegment() : self
- Adds a numeric data segment
- addSegment() : self
- Adds a data segment
- clearSegments() : self
- Clears the data segments array
- getMatrix() : QRMatrix
- getQRMatrix() : QRMatrix
- Returns a QRMatrix object for the given $data and current QROptions
- isAlphaNum() : bool
- checks if a string qualifies as alphanumeric (convenience method)
- isByte() : bool
- a dummy (convenience method)
- isKanji() : bool
- checks if a string qualifies as Kanji (convenience method)
- isNumber() : bool
- checks if a string qualifies as numeric (convenience method)
- readFromBlob() : DecoderResult
- Reads a QR Code from the given data blob
- readFromFile() : DecoderResult
- Reads a QR Code from a given file
- readFromSource() : DecoderResult
- Reads a QR Code from the given luminance source
- render() : mixed
- Renders a QR Code for the given $data and QROptions, saves $file optionally
- renderMatrix() : mixed
- Renders a QR Code for the given QRMatrix and QROptions, saves $file optionally
- setOptions() : self
- Sets an options instance
- addMatrixModifications() : QRMatrix
- add matrix modifications after mask pattern evaluation and before handing over to output
- initOutputInterface() : QROutputInterface
- initializes a fresh built-in or custom QROutputInterface
Constants
ECC_H
public
int
ECC_H
= \chillerlan\QRCode\Common\EccLevel::H
Tags
ECC_L
public
int
ECC_L
= \chillerlan\QRCode\Common\EccLevel::L
Tags
ECC_M
public
int
ECC_M
= \chillerlan\QRCode\Common\EccLevel::M
Tags
ECC_Q
public
int
ECC_Q
= \chillerlan\QRCode\Common\EccLevel::Q
Tags
MASK_PATTERN_AUTO
public
int
MASK_PATTERN_AUTO
= \chillerlan\QRCode\Common\MaskPattern::AUTO
Tags
OUTPUT_CUSTOM
public
string
OUTPUT_CUSTOM
= \chillerlan\QRCode\Output\QROutputInterface::CUSTOM
Tags
OUTPUT_EPS
public
string
OUTPUT_EPS
= \chillerlan\QRCode\Output\QROutputInterface::EPS
Tags
OUTPUT_FPDF
public
string
OUTPUT_FPDF
= \chillerlan\QRCode\Output\QROutputInterface::FPDF
Tags
OUTPUT_IMAGE_GIF
public
string
OUTPUT_IMAGE_GIF
= \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF
Tags
OUTPUT_IMAGE_JPG
public
string
OUTPUT_IMAGE_JPG
= \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG
Tags
OUTPUT_IMAGE_PNG
public
string
OUTPUT_IMAGE_PNG
= \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG
Tags
OUTPUT_IMAGICK
public
string
OUTPUT_IMAGICK
= \chillerlan\QRCode\Output\QROutputInterface::IMAGICK
Tags
OUTPUT_MARKUP_HTML
public
string
OUTPUT_MARKUP_HTML
= \chillerlan\QRCode\Output\QROutputInterface::MARKUP_HTML
Tags
OUTPUT_MARKUP_SVG
public
string
OUTPUT_MARKUP_SVG
= \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG
Tags
OUTPUT_MODES
public
array<string|int, string>
OUTPUT_MODES
= \chillerlan\QRCode\Output\QROutputInterface::MODES
Tags
OUTPUT_STRING_JSON
public
string
OUTPUT_STRING_JSON
= \chillerlan\QRCode\Output\QROutputInterface::STRING_JSON
Tags
OUTPUT_STRING_TEXT
public
string
OUTPUT_STRING_TEXT
= \chillerlan\QRCode\Output\QROutputInterface::STRING_TEXT
Tags
VERSION_AUTO
public
int
VERSION_AUTO
= \chillerlan\QRCode\Common\Version::AUTO
Tags
Properties
$dataSegments
A collection of one or more data segments of QRDataModeInterface instances to write
protected
array<string|int, QRDataModeInterface>
$dataSegments
= []
$luminanceSourceFQN
The luminance source for the reader
protected
string
$luminanceSourceFQN
= \chillerlan\QRCode\Decoder\GDLuminanceSource::class
$options
The settings container
protected
QROptions|SettingsContainerInterface
$options
Methods
__construct()
QRCode constructor.
public
__construct([SettingsContainerInterface $options = null ]) : mixed
PHP8: accept iterable
Parameters
- $options : SettingsContainerInterface = null
addAlphaNumSegment()
Adds an alphanumeric data segment
public
addAlphaNumSegment(string $data) : self
ISO/IEC 18004:2000 8.3.3 - Alphanumeric Mode
Parameters
- $data : string
Return values
selfaddByteSegment()
Adds an 8-bit byte data segment
public
addByteSegment(string $data) : self
ISO/IEC 18004:2000 8.3.4 - 8-bit Byte Mode
Parameters
- $data : string
Return values
selfaddEciDesignator()
Adds a standalone ECI designator
public
addEciDesignator(int $encoding) : self
The ECI designator must be followed by a Byte segment that contains the string encoded according to the given ECI charset
ISO/IEC 18004:2000 8.3.1 - Extended Channel Interpretation (ECI) Mode
Parameters
- $encoding : int
Return values
selfaddEciSegment()
Adds an ECI data segment (including designator)
public
addEciSegment(int $encoding, string $data) : self
The given string will be encoded from mb_internal_encoding() to the given ECI character set
I hate this somehow, but I'll leave it for now
Parameters
- $encoding : int
- $data : string
Tags
Return values
selfaddHanziSegment()
Adds a Hanzi data segment (simplified Chinese 13-bit double-byte characters, GB2312/GB18030)
public
addHanziSegment(string $data) : self
GBT18284-2000 Hanzi Mode
Parameters
- $data : string
Return values
selfaddKanjiSegment()
Adds a Kanji data segment (Japanese 13-bit double-byte characters, Shift-JIS)
public
addKanjiSegment(string $data) : self
ISO/IEC 18004:2000 8.3.5 - Kanji Mode
Parameters
- $data : string
Return values
selfaddNumericSegment()
Adds a numeric data segment
public
addNumericSegment(string $data) : self
ISO/IEC 18004:2000 8.3.2 - Numeric Mode
Parameters
- $data : string
Return values
selfaddSegment()
Adds a data segment
public
addSegment(QRDataModeInterface $segment) : self
ISO/IEC 18004:2000 8.3.6 - Mixing modes ISO/IEC 18004:2000 Annex H - Optimisation of bit stream length
Parameters
- $segment : QRDataModeInterface
Return values
selfclearSegments()
Clears the data segments array
public
clearSegments() : self
Tags
Return values
selfgetMatrix()
public
getMatrix() : QRMatrix
Tags
Return values
QRMatrixgetQRMatrix()
Returns a QRMatrix object for the given $data and current QROptions
public
getQRMatrix() : QRMatrix
Tags
Return values
QRMatrixisAlphaNum()
checks if a string qualifies as alphanumeric (convenience method)
public
isAlphaNum(string $string) : bool
Parameters
- $string : string
Tags
Return values
boolisByte()
a dummy (convenience method)
public
isByte(string $string) : bool
Parameters
- $string : string
Tags
Return values
boolisKanji()
checks if a string qualifies as Kanji (convenience method)
public
isKanji(string $string) : bool
Parameters
- $string : string
Tags
Return values
boolisNumber()
checks if a string qualifies as numeric (convenience method)
public
isNumber(string $string) : bool
Parameters
- $string : string
Tags
Return values
boolreadFromBlob()
Reads a QR Code from the given data blob
public
readFromBlob(string $blob) : DecoderResult
@noinspection PhpUndefinedMethodInspection
Parameters
- $blob : string
Return values
DecoderResultreadFromFile()
Reads a QR Code from a given file
public
readFromFile(string $path) : DecoderResult
Parameters
- $path : string
Tags
Return values
DecoderResultreadFromSource()
Reads a QR Code from the given luminance source
public
readFromSource(LuminanceSourceInterface $source) : DecoderResult
Parameters
- $source : LuminanceSourceInterface
Return values
DecoderResultrender()
Renders a QR Code for the given $data and QROptions, saves $file optionally
public
render([string $data = null ][, string $file = null ]) : mixed
Parameters
- $data : string = null
- $file : string = null
renderMatrix()
Renders a QR Code for the given QRMatrix and QROptions, saves $file optionally
public
renderMatrix(QRMatrix $matrix[, string $file = null ]) : mixed
Parameters
- $matrix : QRMatrix
- $file : string = null
setOptions()
Sets an options instance
public
setOptions(SettingsContainerInterface $options) : self
Parameters
- $options : SettingsContainerInterface
Return values
selfaddMatrixModifications()
add matrix modifications after mask pattern evaluation and before handing over to output
protected
addMatrixModifications(QRMatrix $matrix) : QRMatrix
Parameters
- $matrix : QRMatrix
Return values
QRMatrixinitOutputInterface()
initializes a fresh built-in or custom QROutputInterface
protected
initOutputInterface(QRMatrix $matrix) : QROutputInterface
Parameters
- $matrix : QRMatrix