Giter VIP home page Giter VIP logo

qr-code-bundle's Introduction

QR Code Bundle

By endroid

Latest Stable Version Build Status Total Downloads Monthly Downloads License

This Symfony bundle lets you generate QR Codes using the endroid/qr-code library. It provides the following features:

  • Configure your defaults (like image size, default writer etc.)
  • Support for multiple configurations and injection via aliases
  • Generate QR codes for defined configurations via URL like /qr-code//Hello
  • Generate QR codes or URLs directly from Twig using dedicated functions

Installation

Use Composer to install the library. Also make sure you have enabled and configured the GD extension if you want to generate images.

composer require endroid/qr-code-bundle

When you use Symfony, the installer makes sure that services are automatically wired. If this is not the case you can find the configuration files in the .install/symfony folder.

If you don't want the installer to create the auto-configuration files, it can be disabled as described here.

Configuration

The bundle makes use of builders to create QR codes. The default parameters applied by the builder can optionally be overridden via the configuration. and multiple configurations (thus builders) can be defined.

endroid_qr_code:
    default:
        writer: Endroid\QrCode\Writer\PngWriter
        data: 'This is customized QR code'
        # Label is not implemented for SvgWriter
        labelText: 'This is the label'
        labelFontPath: '%kernel.project_dir%/vendor/endroid/qr-code/assets/noto_sans.otf'
        labelFontSize: 20
        labelAlignment: 'center'
    custom:
        writer: Endroid\QrCode\Writer\SvgWriter
        writerOptions:
            exclude_xml_declaration: true # default: false
        data: 'This is customized QR code'
        size: 300
        encoding: 'UTF-8'
        errorCorrectionLevel: 'low' # 'low', 'medium', 'quartile', or 'high'
        roundBlockSizeMode: 'margin'
        logoPath: '%kernel.project_dir%/vendor/endroid/qr-code/tests/assets/symfony.png'
        logoResizeToWidth: 150
        logoPunchoutBackground: true
        validateResult: false

Using builders

Each configuration results in a builder which can be injected in your classes. For instance the custom builder from the example above can be injected like this and you can override the default configuration as follows.

use Endroid\QrCode\Builder\BuilderInterface;

public function __construct(BuilderInterface $customQrCodeBuilder)
{
    $result = $customQrCodeBuilder
        ->size(400)
        ->margin(20)
        ->build();
}

QR Code Response

The bundle also provides a response object to ease rendering of the resulting image by automatically saving to contents and setting the correct content type.

use Endroid\QrCodeBundle\Response\QrCodeResponse;

$response = new QrCodeResponse($result);

Generate via URL

The bundle provides a controller that allows you to generate QR codes simply by opening an URL like /qr-code/{builder}/{data}. You can configure the prefix in your routing file and pass any of the existing options via query string.

Generate via Twig

The bundle provides a Twig extension for generating a QR code URL, path or data URI. You can use the second argument to specify the builder to use.

<img src="{{ qr_code_path('My QR Code') }}" />
<img src="{{ qr_code_url('My QR Code') }}" />
<img src="{{ qr_code_data_uri('My QR Code') }}" />

{# You can specify the builder via the second parameter #}
<img src="{{ qr_code_data_uri('My QR Code', 'custom') }}" />

{# You can access the width and height via the matrix #}
{% set qrCode = qr_code_result('My QR Code') %}
<img src="{{ qrCode.dataUri }}" width="{{ qrCode.matrix.outerSize }}" />

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This source code is subject to the MIT license bundled in the file LICENSE.

qr-code-bundle's People

Contributors

calvera avatar curry684 avatar endroid avatar epitre avatar javiereguiluz avatar maks-rafalko avatar markwatney2016 avatar philetaylor avatar qdequippe avatar saracevas avatar tacman avatar thomaslandauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

qr-code-bundle's Issues

Changeable content

Hi, How can we update the information we added to the qr code without changing the qr code. The program will generate a qr code. The content will be changed without changing the qr code. How can i do ?

[Feature Request] Allow options to be passed via URL

I use an older version of this bundle in my project where I could append ?&background_color%5Br%5D=255&background_color%5Bg%5D=255&background_color%5Bb%5D=255&foreground_color%5Br%5D=0&foreground_color%5Bg%5D=0&foreground_color%5Bb%5D=0 to the end of the URL to modify the colors.

Is this now no longer possible? Is it on the road map for future development?

Beginning of URL changed for some scanners

Hello, I am able to generate the QR codes correctly and they work on QR code scanner Apps, and on the IOS camera built in QR scanner. However on some handheld scanners they seem to add additional characters at the beginning of the scanned QR code URL.
The beginning of the resulting url is converted from https:// to 000026https//
I have checked the code where I am creating the url and I am not changing the string here, as indeed it works fine on other QR scanners resulting in the correct url. The scanner is a Metrologic.

Dependencies

Can you tell me what php libraries the bundle depends on or how else to solve this error?
When I run the script locally it all works fine, but on my server I get the following error when I try to generate a QR code via Twig, both in prod and dev mode:

The option "/qr-code/https:/MYDOMAIN/meinequittung?hash" does not exist. Defined options are: "background_color", "encoding", "error_correction_level", "foreground_color", "label", "label_alignment", "label_font_path", "label_font_size", "label_margin", "logo_height", "logo_path", "logo_width", "margin", "round_block_size", "size", "validate_result", "writer", "writer_options".

If I copy the image path and run it locally, I get the QR Code.

Thanks

Drop support for PHP 7.3?

I see this library still supports PHP 7.3, which is End of Life (EOL) as of today. What's the policy about PHP support? The only supported versions are 7.4, 8.0 and 8.1.

In my opinion libraries should drop support of PHP versions that are end of life, because it makes contributing to this library much easier.

Generate via factory (question)

Hi,

i'm try to use the 'Generate via factory', but i have a question: how is exactly this works?
i need create a service to use this? if this is so, what are the parameters to use?

$qrCode = $qrCodeFactory->create('QR Code', ['size' => 200]);

$qrCodeFactory, where this variable points?

On use:
"symfony/symfony": "3.4.*",
"endroid/qr-code-bundle": "^3.2",

Route for qr_code_url not loaded as described in docs

I have seen the similar issue #16 and also tried the same as described in the docs by adding the following to my routing.yml

EndroidQrCodeBundle:
    resource: "@EndroidQrCodeBundle/Controller/"
    type:     annotation
    prefix:   /qrcode

This also did not work for me. I looked at the bundle code and GenerateController has no route annotations.

The link to the solution in #16 goes to a 404 page, so I don't know why the issue was closed.

I am using Symfony 3.4

My solution is was add the following to the routing

qr_code_generate:
    path: /qr_code_url/{text}.{extension}
    requirements:
        text: "[\\w\\W]+"
    defaults:
        _controller: Endroid\QrCodeBundle\Controller\GenerateController

Note the addition of /qr_code_url to the path, otherwise any url on your website can be turned into a QR code by adding .png which could also cause error 500's if incorrect query parameters are added.

I don't know if this is the correct solution as it is undocumented, but it works for me and I hope it helps someone else.

Symfony 4.3+ deprecation

The if statement for getRootNode() was correct before a2911e4. Since that change Symfony throws deprecation notes, as current logic always uses deprecated func instead of new one. It's not a problem for 5.0, as func root() is removed there, but 4.4 is LTS and it's pretty annoying. Thanks.


The "Symfony\Component\Config\Definition\Builder\TreeBuilder::root()" method called for the "endroid_qr_code" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead.

image

Do not regenerate `endroid_qr_code.yaml`

I just converted my endroid_qr_code.yaml to endroid_qr_code.php, but I keep getting the YAML file automatically regenerated. I didn't investigate yet when this happens exactly (composer update?), wanted to ask you first:
Since you don't want to drop YAML anytime soon (see #36 (comment)), would it be possible to stop (re)generating the default YAML file if a PHP (or XML?) config file is present?

Can't use qr_code_url. Got an exception.

Hi!

I try to show a QR Code in Twig like this:

{% set qrcode = qr_code_url(shorten_url) %}
<img src="{{ qrcode }}" />

However, I get this error:

An exception has been thrown during the rendering of a template ("Parameter "data" for route "qr_code_generate" must match "[^/]++" ("https://localhost:8000/yvNRQ" given) to generate a corresponding URL.").

The url is a string : "https://localhost:8000/yvNRQ"

It doesn't even work with manually passing any url like:
<img src="{{ qr_code_url('https://github.com/endroid/qr-code-bundle/issues/42') }}" />

qr_code_data_uri

Hey!

In a twig template i use {{ qr_code_data_uri('www.google.com') }} but it returns an empty string it seems.
However going to the link /qr-code/www.google.com.png?size=600 will generate the qr code.

Can you advise me what am i doing wrong?

Thank you in advance!

Add round_block_size_mode to QrCodeFactory

Hi,

Currently the round_block_size option is available to add in the configuration yaml file, but the round_block_size_mode isn't.
Is there a particular reason for that option missing in the factory?

Generating a URL works in V3 but not V4

<img src="{{ qr_code_path('My QR Code') }}" />
<img src="{{ qr_code_url('My QR Code') }}" />

What is "My QR Code" in this context? The twig functions do generate a QR code, but I'm confused on how to generate a QR code using the twig "path" or "url" functions.

Intuitively, it seems like a twig call like

<img src="{{ qr_code_path('item_detail', {itemId: 123, mobile: true) }}" />

Would generate a QR code that, when scanned, would go to "https://example.com/123?mobile=true

I am almost positive this used to work, I found some code in an older project that seems

    {% set url = url('item_show', {itemId: 123} ) %}
            <img height="150" src="{{ qr_code_url(url) }}" />

In fact, downgrading to v3 worked fine. So it seems like something v4 should be able to support. Thanks.

Probleme to generate with twig [http, https].

Hi,
this work :

<img src="http://www.xxxxxx.ap2/app_dev.php/fr/qrcode/http://www.xxxxxx.ap2/app_dev.php/fr/xxx/nfctag/secure/eac9508a7f6d0f5e8cd517b91deb903d.png">

but if i generate in HTTPS das not work :

<img src="https://www.xxxxxx.ap2/app_dev.php/fr/qrcode/https://www.xxxxxx.ap2/app_dev.php/fr/xxx/nfctag/secure/eac9508a7f6d0f5e8cd517b91deb903d.png">

i generate url in controller :

$url        = $this->generateUrl( 'nfc_secure_index',array('machash' => $yneTag->getMachash()), UrlGeneratorInterface::ABSOLUTE_URL );

in twig :
<img src="{{ qrcode_url( url ) }}"/>

here is config :

endroid_qr_code:
    writer: 'png'
    size: 140           # 300  150
    margin: 10
    foreground_color: { r: 0, g: 51, b: 102 }  # 255, 204, 0   0, 51, 102
    background_color: { r: 255, g: 255, b: 255 }
    error_correction_level: quartile # low, medium, quartile or high
    encoding: UTF-8
    label: Yne life
    label_font_size: 14   # 300 13
    label_alignment: center # left, center or right
    label_margin: { b: 20 }
    logo_path: '%kernel.root_dir%/../web/bundles/corestyle/images/xxxxx/commons/[email protected]'
    logo_width: 55    # 150 55
    validate_result: true # checks if the result is readable

can you help ?
Thank.

Ps: SF3.316, qrcode 2.4.0, Windows 10 64, PHP 5.6

symfony 4.2

When I updated to symfony v4.2.0-BETA2 I got this error

The service "Endroid\QrCode\Factory\QrCodeFactory" has a dependency on a non-existent service "Endroid\QrCode\Writer\BinaryWriter".

Can you suggest decision?

Composer require not working due to missing commit hash

  [RuntimeException]                                                           
  Failed to execute git checkout '1e19de01318b4c56daf344194010a0c8bcaf778f' -  
  - && git reset --hard '1e19de01318b4c56daf344194010a0c8bcaf778f' --          
  fatal: reference is not a tree: 1e19de01318b4c56daf344194010a0c8bcaf778f  

PHP 8.0.x: Unable to generate image: check your GD installation

After upgrading to PHP 8 and PHP 8.0.1 respectively, all my Servers (XAMPP and rented comercial space) throw the error

Unable to generate image: check your GD installation

wenn using the following code, or when passing custom parameters
<img src="{{ qr_code_data_uri('02:af31007d151d4c568442f90d6d129ced#31f0677ea8cba7224341f313d8fda1d2121e5122#') }}">

The exact same code works fine in PHP versions earlier than 8.0

I'm on Symfony 5.2.1 and have updated all extensions

Symfony 6 (Class Not Found Exception): Attempted to load class "Builder" from namespace "Endroid\QrCode\Builder"

Hello,

After the update to Symfony 6, I receive this error:

Attempted to load class "Builder" from namespace "Endroid\QrCode\Builder". Did you forget a "use" statement for "PhpParser\Builder"?

I am using Twig to display QR Codes. Like so:

{% set share_text = ib.BusinessPage.BusinessName %}

<img src="{{ qr_code_url(url) }}" />

I am truly no expert and am learning. Does anyone have an idea what might be causing this?

Thank you for your guidance in this.

$defaultQrCodeBuilder doesnt seems to be getting the yaml value.

Hi,

So I have the following yaml config

endroid_qr_code:
    default:
        writer: Endroid\QrCode\Writer\PngWriter
        size: 20
        encoding: 'ISO-8859-1'
        errorCorrectionLevel: 'low'
        roundBlockSizeMode: 'margin'
        validateResult: false
        foregroundColor: ['0, 0, 0']
        backgroundColor: ['255, 255, 255']

and I inject the Builder Interface

public function __construct(BuilderInterface $defaultQrCodeBuilder)
{
     $this->builder = $defaultQrCodeBuilder;
}

then I tried to do this

public function qrCode(string $data)
    {
        $result = $this->builder->data($data)
            ->build();

        header('Content-Type: '. $result->getMimeType());
        return $result->getDataUri();
    }

But my QR code doesn't get the right encoding. When I add ->encoding(new Encoding('ISO-8859-1')) it gives the right result, am i doing something wrong above?

Keep a BC v1.x branch

Due to your git tag changes, it's impossible to keep a deprecated version (1.x) of your bundle inside a SF2 (legacy) project.

I can't upgrade to SF3, and I can't install this composer.json:

{
    "require": {
        "endroid/qrcode-bundle": "^1.0",
        (...)

Because these problems:

$ composer install
  - Installing endroid/qrcode (1.9.3): Loading from cache
  - Installing endroid/qrcode-bundle (1.6.6): Downloading (0%)    Failed to download endroid/qrcode-bundle from dist: The "https://codeload.github.com/endroid/qr-code-bundle/legacy.zip/f8f12fd9f6414a98e21b85acac4859d40b70130e" file could not be downloaded (HTTP/1.1 404 Not Found)
    Now trying to download from source
  - Installing endroid/qrcode-bundle (1.6.6): Cloning f8f12fd9f6 from cache
    f8f12fd9f6414a98e21b85acac4859d40b70130e is gone (history was rewritten?)
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package endroid/qrcode-bundle ^1.0 exists as endroid/qrcode-bundle[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1, dev-master, 3.x-dev] but these are rejected by your constraint.

What can I do to solve it? Thx.

[DependencyInjection] QrCodeExtension not defined, thus not tagged as Twig extension

As of right now, the class QrCodeExtension from endroid/qrcode is not defined as a service within this bundle, so it doesn't get tagged as a Twig extension. I'm not sure what the best way is to resolve this, but I've currently resolved it by defining it in my own application like this:

Endroid\QrCode\Twig\Extension\QrCodeExtension: 
    autoconfigure: true
    autowire: true

The logo appears above the qrcode and partially hides it

Hi!

And thanks for this sweat bundle.
I'm trying to add a logo inside the generated qrcode using last bundle version, but the logo is covering the qrcode and so I am unable to scan it.

Here is a sample:
test

(Generated with default bundle routing : https://127.0.0.1:8000/qr-code/hifolks.png?size=500&logo_height=150&logo_width=150&logo_path=https://i.picsum.photos/id/258/536/354.jpg?hmac=FJZvafgClrsfFxn1Ce6YeBIo2958pGQCb4jCbEc3SRA)

Am I missing something, or is this normal behavior?

Thanks!

Deprecation: A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.

image

$tb = new TreeBuilder();
$tb
    ->root('endroid_qr_code')
        ....
    ->end()

might be replaced with

$tb = new TreeBuilder('endroid_qr_code');
if (method_exists($tb, 'getRootNode')) {
    $rootNode = $tb->getRootNode();
} else {
    // BC layer for symfony/config 4.1 and older
    $rootNode = $tb->root('endroid_qr_code');
}
$rootNode
    //->root('endroid_qr_code') /* remove */
        ....
    //->end() /* remove */

Support for symfony 2.8

Hey there, i use symfony 2.8 LTS, the orders mails stopped working after i upgraded all my packages. I noticed the support for 2.8 was dropped in favor for what?

Can this be fixed?

Incompatibility with Symfony 3.3

The service.yaml uses the !tagged syntax, but this was introduced with Symfony 3.4.
In out Symfony 3.3 app the bundle was updated to 3.1.3, and failed afterwards.
I guess you should raise the minimum version to 3.4. But I can't say which Symfony Component is relevant for this...

Missing HOW to configure the plugin in the doc

Perfect integration, I congratulate you!
But a simple thing .... why not write in the documentation HOW to configure it?
The files in .install/symfony/config must simply copy and paste in the config dir for a quick run in project!

I lost half an hour to understand why the twig environment doesn't found the qr_code_generate function.

Unable to install dev dependency bundle test

Hi,

I would like to contribute to this bundle but when I run composer install on the bundle I have this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for endroid/bundle-test dev-master -> satisfiable by endroid/bundle-test[dev-master].
    - endroid/bundle-test dev-master requires endroid/test dev-master -> satisfiable by endroid/test[dev-master] but these conflict with your requirements or minimum-stability.

Any idea how to install it?

Create a twig function for getting the result object

It would be nice to be able to fill the width and height attribute of the <img>.
Still remembering the discussion at endroid/qr-code#95: Am I right that when setting size: 137 in config/packages/endroid_qr_code.yaml, I can't be sure that the resulting QR code will have exactly 137 width and height?

If so, then I'd suggest to find a way to pass the actual size to the user. I even had an idea how this could look like: Create a function qr_code_object() that works like this:

{% set qr_code = qr_code_object(...) %}
<img src="{{ qr_code.dataUri }}" width="{{ qr_code.width }}" height="{{ qr_code.height }}">

question about recipes v installer

Out of curiosity, why do you use the installer rather than a Symfony recipe? I think everything can be done in the recipe, since the installer is mostly to copy the package and route config.

Again, this is mostly just my own interest, I've been trying to publish recipes for my bundles, it's a bit of a pain. I had also tried rolling my own installation, but that had its own issues.

Recipes are my least favorite part of the symfony ecosystem -- it seems much more intuitive that the recipe would be included in the bundle repo rather than a curated repo that requires a PR. So are you happy with the installer as a solution?

Thanks, and thanks for releasing this bundle as well, it works great!

Unable to generate a URL for the named route "qr_code_generate"

Hello,

I'm testing your bundle but I have an error "Unable to generate a URL for the named route "qr_code_generate"" with Twig Extension

Symfony : 3.4
endroid/qr-code-bundle : 3.2

Config :

endroid_qr_code:
  writer: 'png'
  size: 300
  margin: 10
  foreground_color: { r: 0, g: 0, b: 0 }
  background_color: { r: 255, g: 255, b: 255 }
  error_correction_level: low # low, medium, quartile or high
  encoding: UTF-8
  label: Scan the code
  label_font_size: 20
  label_alignment: left # left, center or right
  label_margin: { b: 20 }
  logo_width: 150
  validate_result: false # checks if the result is readable

Twig
<div class="qrcode"><img src="{{ qr_code_url('https://www.onespot.io')}}" /></div>

I saw the same issue on StackOverflow (https://stackoverflow.com/questions/44559897/endroid-qr-code-in-twig-in-symfony)

he says to add routing

EndroidQrCodeBundle:
    resource: "@EndroidQrCodeBundle/Controller/"
    type:     annotation
    prefix:   /qrcode

I tested it but it doesn't work for me

Thanks

PHP version dependency

I tried to install the bundle with composer but it failed. I use PHP 7.1. The error message was the following:

[InvalidArgumentException]
Package endroid/qr-code-bundle at version has a PHP requirement incompatible with your PHP version (5.5.9)

Is there a way to use the bundle with PHP 7.1?

Generate jpg Images?

Hello,
I am using this extension to generate QR Codes, which I use with dompdf. But dompdf works faster with jpg images. How can I generate jpg QR Codes?

Feature: add logo, colors in twig call

I'd like to be able to set the logo and other options when making the twig call, and I don't think it's possible right now.

The way LiipImagineBundle allows run-time parameters is to pass them as an argument in the twig call, |image_filter('widen', {width: 430}), so I was wonder if there was some way to do that in the QR code generator, e.g.

<img src="{{ qr_code_url('My QR Code', {logo: '/assets/symfony.png') }}" />

OR 

<img src="{{ qr_code_url('My QR Code', bgcolor='pink', logo='my.svg') }}" />

Alternatively, can you document how to create a QR code with a dynamic logo?

Thanks for this great bundle and library.

Issue when upgrading to 4.0

!!  TypeError {#401
!!    #message: "Endroid\QrCodeBundle\DependencyInjection\EndroidQrCodeExtension::createBuilderDefinition(): Argument #2 ($builderConfig) must be of type array, string given, called in /Users/oskar.stark/dev/gansel/kanzlei-butler/vendor/endroid/qr-code-bundle/src/DependencyInjection/EndroidQrCodeExtension.php on line 48"
!!    #code: 0
!!    #file: "./vendor/endroid/qr-code-bundle/src/DependencyInjection/EndroidQrCodeExtension.php"
!!    #line: 54
!!    trace: {
!!      ./vendor/endroid/qr-code-bundle/src/DependencyInjection/EndroidQrCodeExtension.php:54 { …}
!!      ./vendor/endroid/qr-code-bundle/src/DependencyInjection/EndroidQrCodeExtension.php:48 { …}
!!      ./vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php:76 { …}
!!      ./vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php:42 { …}
!!      ./vendor/symfony/dependency-injection/Compiler/Compiler.php:73 { …}
!!      ./vendor/symfony/dependency-injection/ContainerBuilder.php:716 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:538 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:767 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:128 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:166 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:72 { …}
!!      ./vendor/symfony/console/Application.php:171 { …}
!!      ./bin/console:42 {
!!        › $application = new Application($kernel);
!!        › $application->run($input);
!!        ›
!!        arguments: {
!!          $input: Symfony\Component\Console\Input\ArgvInput {#3 …}
!!        }
!!      }
!!    }
!!  }
!!  2022-06-20T10:36:44+00:00 [critical] Uncaught Error: Endroid\QrCodeBundle\DependencyInjection\EndroidQrCodeExtension::createBuilderDefinition(): Argument #2 ($builderConfig) must be of type array, string given, called in /Users/oskar.stark/dev/gansel/kanzlei-butler/vendor/endroid/qr-code-bundle/src/DependencyInjection/EndroidQrCodeExtension.php on line 48

Integrate the bundle in symfony 3.2

Hi! I don't have Symfony Flex. I tried to put in my appKernel.php the following line:

new Endroid\QrCodeBundle\EndroidQrCodeBundle(),

but I have some errors:

PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: A "tags" entry must be an array for service "Endroid\QrCodeBundle\Controller\" in services.yaml. Check your YAML syntax. in C:\Users\JoseAdame\Documents\QuadBuild\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\YamlFileLoader.php:270
Could you help me?

thanks.

PHP 8.1 deprecation notice in Twig/QrCodeExtension.php

With PHP 8.1 I am getting the following deprecation notice:
Method "Twig\Extension\ExtensionInterface::getFunctions()" might add "array" as a native return type declaration in the future. Do the same in implementation "Endroid\QrCodeBundle\Twig\QrCodeExtension" now to avoid errors or add an explicit @return annotation to suppress this message.

Suggestion: Support Symfony's PHP configuration

Symfony is moving from YAML configuration to PHP, see symfony/symfony#37186

With this being my config/routes/endroid_qr_code.php:

<?php declare(strict_types=1);

use function Symfony\Component\DependencyInjection\Loader\Configurator\ref;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routingConfigurator): void {
    $routingConfigurator->import(ref('EndroidQrCodeBundle/Resources/config/routes.yaml'))
        ->prefix('/qr-code');
};

... I'm getting this error:

Cannot load resource "EndroidQrCodeBundle/Resources/config/routes.yaml".

So it looks like this file is blocking it: https://github.com/endroid/qr-code-bundle/blob/master/src/Resources/config/routes.yaml

Suggestion: Provide an alternative src/Resources/config/routes.php

Add qr-code to existing FPDF

It will be nice if we can add a qr-code to an existing PPDF document. Maybe with an function like this:

public function addToFpdf(FPDF &$fpdf, float $x, float $y) {
   ...
}

Suggestion: Inform users to enable GD in PHP.

Great bundle/tool.

Many PHP environments may not have GD enabled (production environments for sure). It would be good to inform users in Installation or configuration instructions to make sure GD is enabled (via phpinfo() or similar).
Also, mention it is probably the cause of the "Unable to generate image: check your GD installation" error. Familiarity with GD extension to PHP is required to understand the error. Otherwise, trips to qr-code/issues/308 and 292 is the most likely way users will figure out what's going on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.