Skip to content

Commit 7448525

Browse files
committed
📖
1 parent e5e9009 commit 7448525

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

docs/Customizing/QROutputAbstract.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ class MyOutput extends QROutputAbstract{
197197
### `collectModules()`
198198

199199
The module collector is particularly useful for plain text based file formats, for example the various markup languages like SVG and HTML or other structured file formats such as EPS.
200-
This method takes a `Closure` as a parameter, which is called with 4 parameters: the module coordinates `$x` and `$y`, the `$M_TYPE` and `$M_TYPE_LAYER`.
200+
This method calls a method `moduleTransform()` internally with 4 parameters: the module coordinates `$x` and `$y`, the `$M_TYPE` and `$M_TYPE_LAYER`.
201+
The transform method should return a value that is valid for a single module of the QR matrix, or `null` if no transform was performed for the current module.
201202
The `$M_TYPE_LAYER` is a copy of the `$M_TYPE` that represents the array key of the returned array and that may have been reassigned in the collector to another path layer, e.g. through `QROptions::$connectPaths`.
202203

203204
```php
@@ -206,7 +207,7 @@ class MyOutput extends QROutputAbstract{
206207
public function dump(string $file = null):string{
207208

208209
// collect the modules for the path elements
209-
$paths = $this->collectModules(fn(int $x, int $y, int $M_TYPE):string => sprintf('%d %d %012b', $x, $y, $M_TYPE));
210+
$paths = $this->collectModules();
210211

211212
// loop over the paths
212213
foreach($paths as $M_TYPE_LAYER => &$path){
@@ -221,6 +222,10 @@ class MyOutput extends QROutputAbstract{
221222
return implode($this->options->eol, $paths);
222223
}
223224

225+
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string{
226+
return sprintf('%d %d %012b', $x, $y, $M_TYPE);
227+
}
228+
224229
}
225230
```
226231

docs/Usage/Advanced-usage.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ You can also set an `iterable` of options on an existing QROptions instance:
3838
$options->fromIterable($myOptions);
3939
```
4040

41+
In addition to that, you can also supply the `iterable` of option values directly to the `QRCode` constructor (v6+):
42+
43+
```php
44+
$qrCode = new QRCode($myOptions);
45+
```
46+
4147

4248
### Load and save options from/to JSON
4349

docs/Usage/Installation.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Installation via [`composer.json`](https://getcomposer.org/doc/04-schema.md):
1212
```json
1313
{
1414
"require": {
15-
"php": "^7.4",
15+
"php": "^8.2",
1616
"chillerlan/php-qrcode": "dev-main"
1717
}
1818
}
@@ -63,7 +63,7 @@ After that, run `composer install` in the package root directory to install the
6363
Profit!
6464

6565

66-
### Can i use this library without using composer?
66+
### Can I use this library without using composer?
6767

6868
You can, but it's absolutely not recommended, nor supported.
6969

@@ -82,8 +82,9 @@ The PHP built-in extensions [GdImage](https://www.php.net/manual/book.image.php)
8282

8383
| version | branch/tag | PHP | supported | required extensions | optional extensions | info |
8484
|---------|----------------------------------------------------------------------|------------------|-----------|---------------------|------------------------------------------------------------------------------------|---------------------------|
85-
| **v5** | [`dev-main`](https://github.com/chillerlan/php-qrcode/tree/main) | `^7.4 \|\| ^8.0` | yes | `mbstring` | `gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick` | |
86-
| **v4** | [`4.3.4`](https://github.com/chillerlan/php-qrcode/tree/v4.3.x) | `^7.4 \|\| ^8.0` | yes | `gd`, `mbstring` | `imagick` | |
85+
| **v6** | [`dev-main`](https://github.com/chillerlan/php-qrcode/tree/main) | `^8.2` | yes | `mbstring` | `gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick` | |
86+
| **v5** | [`5.0.5`](https://github.com/chillerlan/php-qrcode/tree/v5.0.x) | `^7.4 \|\| ^8.0` | yes | `mbstring` | `gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick` | |
87+
| **v4** | [`4.3.4`](https://github.com/chillerlan/php-qrcode/tree/v4.3.x) | `^7.4 \|\| ^8.0` | no | `gd`, `mbstring` | `imagick` | |
8788
| **v3** | [`3.4.1`](https://github.com/chillerlan/php-qrcode/tree/v3.2.x) | `^7.2` | no | `gd`, `mbstring` | `imagick` | v3.4.1 also supports PHP8 |
8889
| **v2** | [`2.0.8`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x) | `>=7.0.3` | no | `gd`, `mbstring` | | |
8990
| **v1** | [`1.0.9`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x-php5) | `>=5.6` | no | `gd`, `mbstring` | | please let PHP 5 die! |

0 commit comments

Comments
 (0)