Skip to content

Commit 6e4c1a8

Browse files
committed
Update supported versions
1 parent 330b58f commit 6e4c1a8

21 files changed

Lines changed: 388 additions & 310 deletions

File tree

‎.github/workflows/CI.yml‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
@@ -10,14 +10,14 @@ jobs:
1010
php-versions: ['8.4', '8.5']
1111
fail-fast: false
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: shivammathur/setup-php@v2
1515
with:
1616
php-version: ${{ matrix.php-versions }}
1717
extensions: gd, mbstring, zip
1818
ini-values: max_execution_time=600, memory_limit=-1
1919
tools: composer:v2
20-
coverage: xdebug
20+
coverage: pcov
2121
env:
2222
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323

@@ -26,7 +26,7 @@ jobs:
2626
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2727

2828
- name: Cache composer dependencies
29-
uses: actions/cache@v4
29+
uses: actions/cache@v5
3030
with:
3131
path: ${{ steps.composercache.outputs.dir }}
3232
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -47,8 +47,6 @@ jobs:
4747
4848
- name: Check code quality
4949
run: vendor/bin/code-quality
50-
env:
51-
PHP_CS_FIXER_IGNORE_ENV: 1
5250

5351
- name: Test against lowest versions
5452
run: |
@@ -58,13 +56,13 @@ jobs:
5856
5957
- name: Archive logs
6058
if: ${{ failure() }}
61-
uses: actions/upload-artifact@v4
59+
uses: actions/upload-artifact@v6
6260
with:
6361
name: logs-php-${{ matrix.php-versions }}
6462
path: vendor/endroid/quality/application/var/log
6563

6664
- name: Archive code coverage results
67-
uses: actions/upload-artifact@v5
65+
uses: actions/upload-artifact@v6
6866
with:
6967
name: coverage-php-${{ matrix.php-versions }}
7068
path: tests/coverage

‎.install/symfony/config/packages/endroid_qr_code.yaml‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎.install/symfony/config/routes/endroid_qr_code.yaml‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2025 (c) Jeroen van den Enden
1+
Copyright (c) Jeroen van den Enden
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

‎README.md‎

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Monthly Downloads](http://img.shields.io/packagist/dm/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)
99
[![License](http://img.shields.io/packagist/l/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)
1010

11-
This Symfony bundle lets you generate QR Codes using the [endroid/qr-code](https://github.com/endroid/QrCode)
11+
This Symfony bundle lets you generate QR Codes using the [endroid/qr-code](https://github.com/endroid/qr-code)
1212
library. It provides the following features:
1313

1414
* Configure your defaults (like image size, default writer etc.)
@@ -25,48 +25,59 @@ Use [Composer](https://getcomposer.org/) to install the library. Also make sure
2525
composer require endroid/qr-code-bundle
2626
```
2727

28-
When you use Symfony, the [installer](https://github.com/endroid/installer)
29-
makes sure that services are automatically wired. If this is not the case you
30-
can find the configuration files in the `.install/symfony` folder.
28+
### Route Configuration
3129

32-
If you don't want the installer to create the auto-configuration files, it can
33-
be disabled as described [here](https://github.com/endroid/installer#configuration).
30+
By default the bundle registers a controller that generates QR codes via the URL
31+
`/qr-code/{builder}/{data}`. If you only use QR codes programmatically or via Twig
32+
and don't need the route, you can disable it. You can also set a custom prefix.
3433

35-
## Configuration
34+
```yaml
35+
endroid_qr_code:
36+
route_enabled: true
37+
route_prefix: '/my-custom-prefix'
38+
```
39+
40+
This makes the route available at `/my-custom-prefix/{builder}/{data}`.
41+
42+
## Builder Configuration
3643

3744
The bundle makes use of builders to create QR codes. The default parameters
38-
applied by the builder can optionally be overridden via the configuration. and
45+
applied by the builder can optionally be overridden via the configuration. And
3946
multiple configurations (thus builders) can be defined.
4047

48+
Each entry under `builders` defines a named builder with its own defaults.
49+
When no builders are configured the bundle registers a single `default` builder.
50+
4151
```yaml
4252
endroid_qr_code:
43-
default:
44-
writer: Endroid\QrCode\Writer\PngWriter
45-
data: 'This is customized QR code'
46-
logo_path: '%kernel.project_dir%/vendor/endroid/qr-code/tests/assets/symfony.png'
47-
logo_resize_to_width: 150
48-
logo_punchout_background: true # only supported by PngWriter
49-
label_text: 'This is the label'
50-
label_font_path: '%kernel.project_dir%/vendor/endroid/qr-code/assets/noto_sans.otf'
51-
label_font_size: 20
52-
label_alignment: 'center'
53-
custom:
54-
writer: Endroid\QrCode\Writer\SvgWriter
55-
writer_options:
56-
exclude_xml_declaration: true # default: false
57-
data: 'This is customized QR code'
58-
size: 300
59-
encoding: 'UTF-8'
60-
error_correction_level: 'low' # 'low', 'medium', 'quartile', or 'high'
61-
round_block_size_mode: 'margin'
62-
validate_result: false
53+
builders:
54+
default:
55+
writer: Endroid\QrCode\Writer\PngWriter
56+
data: 'This is customized QR code'
57+
logo_path: '%kernel.project_dir%/vendor/endroid/qr-code/tests/assets/symfony.png'
58+
logo_resize_to_width: 150
59+
logo_punchout_background: true # only supported by PngWriter
60+
label_text: 'This is the label'
61+
label_font_path: '%kernel.project_dir%/vendor/endroid/qr-code/assets/noto_sans.otf'
62+
label_font_size: 20
63+
label_alignment: 'center'
64+
custom:
65+
writer: Endroid\QrCode\Writer\SvgWriter
66+
writer_options:
67+
exclude_xml_declaration: true # default: false
68+
data: 'This is customized QR code'
69+
size: 300
70+
encoding: 'UTF-8'
71+
error_correction_level: 'low' # 'low', 'medium', 'quartile', or 'high'
72+
round_block_size_mode: 'margin'
73+
validate_result: false
6374
```
6475

65-
## Using builders
76+
## Using Named Builders
6677

67-
Each configuration results in a builder which can be injected in your classes.
68-
For instance the custom builder from the example above can be injected like this
69-
and you can override the default configuration as follows.
78+
Each builder is available for injection using its name suffixed with
79+
`QrCodeBuilder`. For example the `custom` builder above can be injected as
80+
`$customQrCodeBuilder`. You can override the configured defaults at build time:
7081

7182
```php
7283
use Endroid\QrCode\Builder\BuilderInterface;
@@ -91,13 +102,7 @@ use Endroid\QrCodeBundle\Response\QrCodeResponse;
91102
$response = new QrCodeResponse($result);
92103
```
93104

94-
## Generate via URL
95-
96-
The bundle provides a controller that allows you to generate QR codes simply
97-
by opening an URL like /qr-code/{builder}/{data}. You can configure the prefix
98-
in your routing file and pass any of the existing options via query string.
99-
100-
## Generate via Twig
105+
## Twig Extension
101106

102107
The bundle provides a Twig extension for generating a QR code URL, path or data
103108
URI. You can use the second argument to specify the builder to use.
@@ -114,6 +119,8 @@ URI. You can use the second argument to specify the builder to use.
114119
{% set qrCode = qr_code_result('My QR Code') %}
115120
<img src="{{ qrCode.dataUri }}" width="{{ qrCode.matrix.outerSize }}" />
116121
```
122+
123+
Please note that some Twig functions need the route to be enabled to function.
117124

118125
## Versioning
119126

‎composer.json‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"name": "endroid/qr-code-bundle",
33
"description": "Endroid QR Code Bundle",
4-
"keywords": ["endroid", "qr", "code", "symfony", "bundle", "php"],
4+
"keywords": [
5+
"endroid",
6+
"qr",
7+
"code",
8+
"symfony",
9+
"bundle",
10+
"php"
11+
],
512
"homepage": "https://github.com/endroid/qr-code-bundle",
613
"type": "symfony-bundle",
714
"license": "MIT",
@@ -13,11 +20,9 @@
1320
],
1421
"require": {
1522
"php": "^8.4",
16-
"endroid/installer": "^1.5",
1723
"endroid/qr-code": "^6.1.0",
1824
"symfony/framework-bundle": "^6.4||^7.4||^8.0",
19-
"symfony/twig-bundle": "^6.4||^7.4||^8.0",
20-
"symfony/yaml": "^6.4||^7.4||^8.0"
25+
"symfony/twig-bundle": "^6.4||^7.4||^8.0"
2126
},
2227
"require-dev": {
2328
"endroid/quality": "dev-main"
@@ -37,13 +42,13 @@
3742
},
3843
"extra": {
3944
"branch-alias": {
40-
"dev-main": "6.x-dev"
45+
"dev-main": "7.x-dev"
4146
}
4247
},
4348
"config": {
4449
"sort-packages": true,
4550
"allow-plugins": {
46-
"endroid/installer": true
51+
"carthage-software/mago": true
4752
}
4853
}
4954
}

‎src/Controller/GenerateController.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
{
1414
public function __construct(
1515
private BuilderRegistryInterface $builderRegistry,
16-
) {
17-
}
16+
) {}
1817

1918
public function __invoke(string $builder, string $data): Response
2019
{

‎src/DependencyInjection/Configuration.php‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)