Skip to content

Commit 4461699

Browse files
committed
📖
1 parent 03aac9e commit 4461699

File tree

10 files changed

+51
-115
lines changed

10 files changed

+51
-115
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ It also features a QR Code reader based on a [PHP port](https://github.com/khana
3838
- numeric
3939
- alphanumeric
4040
- 8-bit binary
41+
- [ECI support](https://en.wikipedia.org/wiki/Extended_Channel_Interpretation)
4142
- 13-bit double-byte:
4243
- kanji (Japanese, Shift-JIS)
4344
- hanzi (simplified Chinese, GB2312/GB18030) as [defined in GBT18284-2000](https://www.chinesestandard.net/PDF/English.aspx/GBT18284-2000)
4445
- Flexible, easily extensible output modules, built-in support for the following output formats:
45-
- [GdImage](https://www.php.net/manual/book.image)
46-
- [ImageMagick](https://www.php.net/manual/book.imagick)
46+
- [GdImage](https://www.php.net/manual/book.image) (raster graphics: avif, bmp, gif, jpeg, png, webp)
47+
- [ImageMagick](https://www.php.net/manual/book.imagick) ([multiple supported image formats](https://imagemagick.org/script/formats.php))
4748
- Markup types: SVG, HTML, etc.
4849
- String types: JSON, plain text, etc.
4950
- Encapsulated Postscript (EPS)
@@ -53,7 +54,7 @@ It also features a QR Code reader based on a [PHP port](https://github.com/khana
5354

5455
### Requirements
5556

56-
- PHP 7.4+
57+
- PHP 8.2+
5758
- [`ext-mbstring`](https://www.php.net/manual/book.mbstring.php)
5859
- optional:
5960
- [`ext-gd`](https://www.php.net/manual/book.image)
@@ -88,13 +89,13 @@ composer require chillerlan/php-qrcode
8889
```json
8990
{
9091
"require": {
91-
"php": "^7.4 || ^8.0",
92+
"php": "^^8.2",
9293
"chillerlan/php-qrcode": "dev-main#<commit_hash>"
9394
}
9495
}
9596
```
9697

97-
Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^4.3` - see [releases](https://github.com/chillerlan/php-qrcode/releases) for valid versions.
98+
Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^5.0` - see [releases](https://github.com/chillerlan/php-qrcode/releases) for valid versions.
9899

99100

100101
## Quickstart

docs/Built-In-Output/QREps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Set the options:
1212
```php
1313
$options = new QROptions;
1414

15-
$options->outputType = QROutputInterface::EPS;
15+
$options->outputInterface = QREps::class;
1616
$options->scale = 5;
1717
$options->drawLightModules = false;
1818
// colors can be specified either as [R, G, B] or [C, M, Y, K] (0-255)

docs/Built-In-Output/QRFpdf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Set the options:
1212
```php
1313
$options = new QROptions;
1414

15-
$options->outputType = QROutputInterface::FPDF;
15+
$options->outputInterface = QRFpdf::class;
1616
$options->scale = 5;
1717
$options->fpdfMeasureUnit = 'mm'; // pt, mm, cm, in
1818
$options->bgColor = [222, 222, 222]; // [R, G, B]

docs/Built-In-Output/QRGdImage.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
See: [GdImage example](https://github.com/chillerlan/php-qrcode/blob/main/examples/image.php)
99

1010
Set the options:
11+
1112
```php
1213
$options = new QROptions;
1314

14-
// $outputType can be one of: GDIMAGE_BMP, GDIMAGE_GIF, GDIMAGE_JPG, GDIMAGE_PNG, GDIMAGE_WEBP
15-
$options->outputType = QROutputInterface::GDIMAGE_WEBP;
15+
// $outputInterface can be one of the classes listed in `QROutputInterface::MODES`
16+
$options->outputInterface = QRGdImageWEBP::class;
1617
$options->quality = 90;
1718
// the size of one qr module in pixels
1819
$options->scale = 20;

docs/Built-In-Output/QRImagick.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ Please follow the installation guides for your operating system:
1414
See: [ImageMagick example](https://github.com/chillerlan/php-qrcode/blob/main/examples/imagick.php)
1515

1616
Set the options:
17+
1718
```php
1819
$options = new QROptions;
1920

20-
$options->outputType = QROutputInterface::IMAGICK;
21+
$options->outputInterface = QRImagick::class;
2122
$options->imagickFormat = 'webp'; // e.g. png32, jpeg, webp
2223
$options->quality = 90;
2324
$options->scale = 20;

docs/Built-In-Output/QRMarkupHTML.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Set the options:
1515
```php
1616
$options = new QROptions;
1717

18-
$options->outputType = QROutputInterface::MARKUP_HTML;
19-
$options->cssClass = 'qrcode';
20-
$options->moduleValues = [
18+
$options->outputInterface = QRMarkupHTML::class;
19+
$options->cssClass = 'qrcode';
20+
$options->moduleValues = [
2121
// finder
2222
QRMatrix::M_FINDER_DARK => '#A71111', // dark (true)
2323
QRMatrix::M_FINDER_DOT => '#A71111', // finder dot, dark (true)

docs/Built-In-Output/QRMarkupSVG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Set the options:
1212
$options = new QROptions;
1313

1414
$options->version = 7;
15-
$options->outputType = QROutputInterface::MARKUP_SVG;
15+
$options->outputInterface = QRMarkupSVG::class;
1616
// if set to false, the light modules won't be rendered
1717
$options->drawLightModules = true;
1818
$options->svgUseFillAttributes = true;

docs/Built-In-Output/QRString.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ function ansi8(string $str, int $color, bool $background = false):string{
1717

1818
$options = new QROptions;
1919

20-
$options->outputType = QROutputInterface::STRING_TEXT;
21-
$options->eol = "\n";
20+
$options->outputInterface = QRStringText::class;
21+
$options->eol = "\n";
2222
// add some space on the line start
23-
$options->textLineStart = str_repeat(' ', 6);
23+
$options->textLineStart = str_repeat(' ', 6);
2424
// default values for unassigned module types
25-
$options->textDark = QRString::ansi8('██', 253);
26-
$options->textLight = QRString::ansi8('░░', 253);
27-
$options->moduleValues = [
28-
QRMatrix::M_FINDER_DARK => QRString::ansi8('██', 124),
29-
QRMatrix::M_FINDER => QRString::ansi8('░░', 124),
30-
QRMatrix::M_FINDER_DOT => QRString::ansi8('██', 124),
31-
QRMatrix::M_ALIGNMENT_DARK => QRString::ansi8('██', 2),
32-
QRMatrix::M_ALIGNMENT => QRString::ansi8('░░', 2),
33-
QRMatrix::M_VERSION_DARK => QRString::ansi8('██', 21),
34-
QRMatrix::M_VERSION => QRString::ansi8('░░', 21),
25+
$options->textDark = QRStringText::ansi8('██', 253);
26+
$options->textLight = QRStringText::ansi8('░░', 253);
27+
$options->moduleValues = [
28+
QRMatrix::M_FINDER_DARK => QRStringText::ansi8('██', 124),
29+
QRMatrix::M_FINDER => QRStringText::ansi8('░░', 124),
30+
QRMatrix::M_FINDER_DOT => QRStringText::ansi8('██', 124),
31+
QRMatrix::M_ALIGNMENT_DARK => QRStringText::ansi8('██', 2),
32+
QRMatrix::M_ALIGNMENT => QRStringText::ansi8('░░', 2),
33+
QRMatrix::M_VERSION_DARK => QRStringText::ansi8('██', 21),
34+
QRMatrix::M_VERSION => QRStringText::ansi8('░░', 21),
3535
];
3636
```
3737

docs/Usage/Configuration-settings.md

Lines changed: 18 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ if `QROptions::$version` is set to `Version::AUTO` (default: 40)
3030

3131
Error correct level
3232

33-
`EccLevel::X` where `X` is:
33+
the constant `EccLevel::X` where `X` is:
3434

3535
- `L` => 7% (default)
3636
- `M` => 15%
3737
- `Q` => 25%
3838
- `H` => 30%
3939

40+
alternatively you can just pass the letters L/M/Q/H (case-insensitive) to the magic setter
41+
4042

4143
**See also:**
4244

@@ -73,47 +75,9 @@ Size of the quiet zone
7375
internally clamped to `0 ... $moduleCount / 2` (default: 4)
7476

7577

76-
## outputType
77-
78-
The built-in output type
79-
80-
- `QROutputInterface::MARKUP_SVG` (default)
81-
- `QROutputInterface::MARKUP_HTML`
82-
- `QROutputInterface::GDIMAGE_BMP`
83-
- `QROutputInterface::GDIMAGE_GIF`
84-
- `QROutputInterface::GDIMAGE_JPG`
85-
- `QROutputInterface::GDIMAGE_PNG`
86-
- `QROutputInterface::GDIMAGE_WEBP`
87-
- `QROutputInterface::STRING_TEXT`
88-
- `QROutputInterface::STRING_JSON`
89-
- `QROutputInterface::IMAGICK`
90-
- `QROutputInterface::EPS`
91-
- `QROutputInterface::FPDF`
92-
- `QROutputInterface::CUSTOM`
93-
94-
95-
**Deprecated:** 5.0.0 see issue #223
96-
97-
**See also:**
98-
99-
- `\chillerlan\QRCode\Output\QREps`
100-
- `\chillerlan\QRCode\Output\QRFpdf`
101-
- `\chillerlan\QRCode\Output\QRGdImage`
102-
- `\chillerlan\QRCode\Output\QRImagick`
103-
- `\chillerlan\QRCode\Output\QRMarkupHTML`
104-
- `\chillerlan\QRCode\Output\QRMarkupSVG`
105-
- `\chillerlan\QRCode\Output\QRString`
106-
- [github.com/chillerlan/php-qrcode/issues/223](https://github.com/chillerlan/php-qrcode/issues/223)
107-
108-
10978
## outputInterface
11079

111-
The FQCN of the custom `QROutputInterface`
112-
113-
if `QROptions::$outputType` is set to `QROutputInterface::CUSTOM` (default: `null`)
114-
115-
**Deprecated:** 5.0.0 the nullable type will be removed in future versions
116-
and the default value will be set to `QRMarkupSVG::class`
80+
The FQCN of the `QROutputInterface` to use
11781

11882

11983
## returnResource
@@ -175,7 +139,6 @@ Sets the image background color (if applicable)
175139
- `QRFpdf`: defaults to blank internally (white page)
176140

177141

178-
179142
## invertMatrix
180143

181144
Whether to invert the matrix (reflectance reversal)
@@ -232,9 +195,18 @@ Specifies which module types to exclude when `QROptions::$drawCircularModules` i
232195

233196
Whether to connect the paths for the several module types to avoid weird glitches when using gradients etc.
234197

198+
This option is exclusive to output classes that use the module collector `QROutputAbstract::collectModules()`,
199+
which converts the `$M_TYPE` of all modules to `QRMatrix::M_DATA` and `QRMatrix::M_DATA_DARK` respectively.
200+
201+
Module types that should not be added to the connected path can be excluded via `QROptions::$excludeFromConnect`.
202+
203+
Currentty used in `QREps` and `QRMarkupSVG`.
204+
235205

236206
**See also:**
237207

208+
- `\chillerlan\QRCode\Output\QROutputAbstract::collectModules()`
209+
- `\chillerlan\QRCode\QROptionsTrait::$excludeFromConnect`
238210
- [github.com/chillerlan/php-qrcode/issues/57](https://github.com/chillerlan/php-qrcode/issues/57)
239211

240212

@@ -243,6 +215,11 @@ Whether to connect the paths for the several module types to avoid weird glitche
243215
Specify which paths/patterns to exclude from connecting if `QROptions::$connectPaths` is set to `true`
244216

245217

218+
**See also:**
219+
220+
- `\chillerlan\QRCode\QROptionsTrait::$connectPaths`
221+
222+
246223
## moduleValues
247224

248225
Module values map
@@ -467,48 +444,3 @@ Increase the contrast before reading
467444

468445
note that applying contrast works different in GD and Imagick, so mileage may vary
469446

470-
471-
## imageBase64
472-
473-
**Deprecated:** 5.0.0 use QROptions::$outputBase64 instead
474-
475-
**See also:**
476-
477-
- ` \chillerlan\QRCode\QROptions::$outputBase64`
478-
479-
480-
## jpegQuality
481-
482-
**Deprecated:** 5.0.0 use QROptions::$quality instead
483-
484-
**See also:**
485-
486-
- ` \chillerlan\QRCode\QROptions::$quality`
487-
488-
489-
## pngCompression
490-
491-
**Deprecated:** 5.0.0 use QROptions::$quality instead
492-
493-
**See also:**
494-
495-
- ` \chillerlan\QRCode\QROptions::$quality`
496-
497-
498-
## imageTransparencyBG
499-
500-
**Deprecated:** 5.0.0 use QROptions::$transparencyColor instead
501-
502-
**See also:**
503-
504-
- ` \chillerlan\QRCode\QROptions::$transparencyColor`
505-
506-
507-
## imagickBG
508-
509-
**Deprecated:** 5.0.0 use QROptions::$bgColor instead
510-
511-
**See also:**
512-
513-
- ` \chillerlan\QRCode\QROptions::$bgColor`
514-

docs/Usage/Overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ It also features a QR Code reader based on a [PHP port](https://github.com/khana
1212
- numeric
1313
- alphanumeric
1414
- 8-bit binary
15+
- [ECI support](https://en.wikipedia.org/wiki/Extended_Channel_Interpretation)
1516
- 13-bit double-byte:
1617
- kanji (Japanese, Shift-JIS)
1718
- hanzi (simplified Chinese, GB2312/GB18030) as [defined in GBT18284-2000](https://www.chinesestandard.net/PDF/English.aspx/GBT18284-2000)
1819
- Flexible, easily extensible output modules, built-in support for the following output formats:
19-
- [GdImage](https://www.php.net/manual/book.image)
20-
- [ImageMagick](https://www.php.net/manual/book.imagick)
20+
- [GdImage](https://www.php.net/manual/book.image) (raster graphics: avif, bmp, gif, jpeg, png, webp)
21+
- [ImageMagick](https://www.php.net/manual/book.imagick) ([multiple supported image formats](https://imagemagick.org/script/formats.php))
2122
- Markup types: SVG, HTML, etc.
2223
- String types: JSON, plain text, etc.
2324
- Encapsulated Postscript (EPS)

0 commit comments

Comments
 (0)