Documentation

QRCode
in package

Turns a text string into a Model 2 QR Code

Tags
see
https://github.com/kazuhikoarase/qrcode-generator/tree/master/php
see
https://www.qrcode.com/en/codes/model12.html
see
https://www.swisseduc.ch/informatik/theoretische_informatik/qr_codes/docs/qr_standard.pdf
see
https://en.wikipedia.org/wiki/QR_code
see
https://www.thonky.com/qr-code-tutorial/

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
deprecated
5.0.0

use EccLevel::H instead

see
EccLevel::H

ECC_L

public int ECC_L = \chillerlan\QRCode\Common\EccLevel::L
Tags
deprecated
5.0.0

use EccLevel::L instead

see
EccLevel::L

ECC_M

public int ECC_M = \chillerlan\QRCode\Common\EccLevel::M
Tags
deprecated
5.0.0

use EccLevel::M instead

see
EccLevel::M

ECC_Q

public int ECC_Q = \chillerlan\QRCode\Common\EccLevel::Q
Tags
deprecated
5.0.0

use EccLevel::Q instead

see
EccLevel::Q

MASK_PATTERN_AUTO

public int MASK_PATTERN_AUTO = \chillerlan\QRCode\Common\MaskPattern::AUTO
Tags
deprecated
5.0.0

use MaskPattern::AUTO instead

see
MaskPattern::AUTO

OUTPUT_CUSTOM

public string OUTPUT_CUSTOM = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM
Tags
deprecated
5.0.0

use QROutputInterface::CUSTOM instead

see
QROutputInterface::CUSTOM

OUTPUT_EPS

public string OUTPUT_EPS = \chillerlan\QRCode\Output\QROutputInterface::EPS
Tags
deprecated
5.0.0

use QROutputInterface::EPS instead

see
QROutputInterface::EPS

OUTPUT_FPDF

public string OUTPUT_FPDF = \chillerlan\QRCode\Output\QROutputInterface::FPDF
Tags
deprecated
5.0.0

use QROutputInterface::FPDF instead

see
QROutputInterface::FPDF

OUTPUT_IMAGE_GIF

public string OUTPUT_IMAGE_GIF = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF
Tags
deprecated
5.0.0

use QROutputInterface::GDIMAGE_GIF instead

see
QROutputInterface::GDIMAGE_GIF

OUTPUT_IMAGE_JPG

public string OUTPUT_IMAGE_JPG = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG
Tags
deprecated
5.0.0

use QROutputInterface::GDIMAGE_JPG instead

see
QROutputInterface::GDIMAGE_JPG

OUTPUT_IMAGE_PNG

public string OUTPUT_IMAGE_PNG = \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG
Tags
deprecated
5.0.0

use QROutputInterface::GDIMAGE_PNG instead

see
QROutputInterface::GDIMAGE_PNG

OUTPUT_IMAGICK

public string OUTPUT_IMAGICK = \chillerlan\QRCode\Output\QROutputInterface::IMAGICK
Tags
deprecated
5.0.0

use QROutputInterface::IMAGICK instead

see
QROutputInterface::IMAGICK

OUTPUT_MARKUP_HTML

public string OUTPUT_MARKUP_HTML = \chillerlan\QRCode\Output\QROutputInterface::MARKUP_HTML
Tags
deprecated
5.0.0

use QROutputInterface::MARKUP_HTML instead

see
QROutputInterface::MARKUP_HTML

OUTPUT_MARKUP_SVG

public string OUTPUT_MARKUP_SVG = \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG
Tags
deprecated
5.0.0

use QROutputInterface::MARKUP_SVG instead

see
QROutputInterface::MARKUP_SVG

OUTPUT_MODES

public array<string|int, string> OUTPUT_MODES = \chillerlan\QRCode\Output\QROutputInterface::MODES
Tags
deprecated
5.0.0

use QROutputInterface::MODES instead

see
QROutputInterface::MODES

OUTPUT_STRING_JSON

public string OUTPUT_STRING_JSON = \chillerlan\QRCode\Output\QROutputInterface::STRING_JSON
Tags
deprecated
5.0.0

use QROutputInterface::STRING_JSON instead

see
QROutputInterface::STRING_JSON

OUTPUT_STRING_TEXT

public string OUTPUT_STRING_TEXT = \chillerlan\QRCode\Output\QROutputInterface::STRING_TEXT
Tags
deprecated
5.0.0

use QROutputInterface::STRING_TEXT instead

see
QROutputInterface::STRING_TEXT

VERSION_AUTO

public int VERSION_AUTO = \chillerlan\QRCode\Common\Version::AUTO
Tags
deprecated
5.0.0

use Version::AUTO instead

see
Version::AUTO

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
self

addByteSegment()

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
self

addEciDesignator()

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
self

addEciSegment()

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
throws
QRCodeException
Return values
self

addHanziSegment()

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
self

addKanjiSegment()

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
self

addNumericSegment()

Adds a numeric data segment

public addNumericSegment(string $data) : self

ISO/IEC 18004:2000 8.3.2 - Numeric Mode

Parameters
$data : string
Return values
self

addSegment()

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
self

clearSegments()

Clears the data segments array

public clearSegments() : self
Tags
codeCoverageIgnore
Return values
self

isAlphaNum()

checks if a string qualifies as alphanumeric (convenience method)

public isAlphaNum(string $string) : bool
Parameters
$string : string
Tags
deprecated
5.0.0

use AlphaNum::validateString() instead

see
AlphaNum::validateString()
codeCoverageIgnore
Return values
bool

isByte()

a dummy (convenience method)

public isByte(string $string) : bool
Parameters
$string : string
Tags
deprecated
5.0.0

use Byte::validateString() instead

see
Byte::validateString()
codeCoverageIgnore
Return values
bool

isKanji()

checks if a string qualifies as Kanji (convenience method)

public isKanji(string $string) : bool
Parameters
$string : string
Tags
deprecated
5.0.0

use Kanji::validateString() instead

see
Kanji::validateString()
codeCoverageIgnore
Return values
bool

isNumber()

checks if a string qualifies as numeric (convenience method)

public isNumber(string $string) : bool
Parameters
$string : string
Tags
deprecated
5.0.0

use Number::validateString() instead

see
Number::validateString()
codeCoverageIgnore
Return values
bool

readFromBlob()

Reads a QR Code from the given data blob

public readFromBlob(string $blob) : DecoderResult

@noinspection PhpUndefinedMethodInspection

Parameters
$blob : string
Return values
DecoderResult

readFromFile()

Reads a QR Code from a given file

public readFromFile(string $path) : DecoderResult
Parameters
$path : string
Tags
noinspection

PhpUndefinedMethodInspection

Return values
DecoderResult

render()

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
self

addMatrixModifications()

add matrix modifications after mask pattern evaluation and before handing over to output

protected addMatrixModifications(QRMatrix $matrix) : QRMatrix
Parameters
$matrix : QRMatrix
Return values
QRMatrix

        
On this page

Search results