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

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  : SettingsContainerInterface|QROptions
The settings container

Methods

__construct()  : mixed
QRCode constructor.
addAlphaNumSegment()  : static
Adds an alphanumeric data segment
addByteSegment()  : static
Adds an 8-bit byte data segment
addEciDesignator()  : static
Adds a standalone ECI designator
addEciSegment()  : static
Adds an ECI data segment (including designator)
addHanziSegment()  : static
Adds a Hanzi data segment (simplified Chinese 13-bit double-byte characters, GB2312/GB18030)
addKanjiSegment()  : static
Adds a Kanji data segment (Japanese 13-bit double-byte characters, Shift-JIS)
addNumericSegment()  : static
Adds a numeric data segment
addSegment()  : static
Adds a data segment
clearSegments()  : static
Clears the data segments array
getQRMatrix()  : QRMatrix
Returns a QRMatrix object for the given $data and current QROptions
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()  : static
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

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\Common\GDLuminanceSource::class

$options

The settings container

protected SettingsContainerInterface|QROptions $options

Methods

__construct()

QRCode constructor.

public __construct([SettingsContainerInterface|QROptions $options = new QROptions() ]) : mixed

PHP8: accept iterable

Parameters
$options : SettingsContainerInterface|QROptions = new QROptions()

addAlphaNumSegment()

Adds an alphanumeric data segment

public addAlphaNumSegment(string $data) : static

ISO/IEC 18004:2000 8.3.3 - Alphanumeric Mode

Parameters
$data : string
Return values
static

addByteSegment()

Adds an 8-bit byte data segment

public addByteSegment(string $data) : static

ISO/IEC 18004:2000 8.3.4 - 8-bit Byte Mode

Parameters
$data : string
Return values
static

addEciDesignator()

Adds a standalone ECI designator

public addEciDesignator(int $encoding) : static

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
static

addEciSegment()

Adds an ECI data segment (including designator)

public addEciSegment(int $encoding, string $data) : static

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
static

addHanziSegment()

Adds a Hanzi data segment (simplified Chinese 13-bit double-byte characters, GB2312/GB18030)

public addHanziSegment(string $data) : static

GBT18284-2000 Hanzi Mode

Parameters
$data : string
Return values
static

addKanjiSegment()

Adds a Kanji data segment (Japanese 13-bit double-byte characters, Shift-JIS)

public addKanjiSegment(string $data) : static

ISO/IEC 18004:2000 8.3.5 - Kanji Mode

Parameters
$data : string
Return values
static

addNumericSegment()

Adds a numeric data segment

public addNumericSegment(string $data) : static

ISO/IEC 18004:2000 8.3.2 - Numeric Mode

Parameters
$data : string
Return values
static

addSegment()

Adds a data segment

public addSegment(QRDataModeInterface $segment) : static

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
static

clearSegments()

Clears the data segments array

public clearSegments() : static
Tags
codeCoverageIgnore
Return values
static

getQRMatrix()

Returns a QRMatrix object for the given $data and current QROptions

public getQRMatrix() : QRMatrix
Return values
QRMatrix

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|QROptions $options) : static
Parameters
$options : SettingsContainerInterface|QROptions
Return values
static

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