2017 © Pedro Peláez
 

library qrcode

Endroid QR Code

image

codeages/qrcode

Endroid QR Code

  • Wednesday, August 2, 2017
  • by Wellming
  • Repository
  • 3 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 320 Forks
  • 0 Open issues
  • 61 Versions
  • 0 % Grown

The README.md

QR Code

By endroid, (*1)

Latest Stable Version Build Status Total Downloads Monthly Downloads License, (*2)

This library helps you generate QR codes in an easy way and provides a Symfony bundle for rapid integration in your project., (*3)

Installation

Use Composer to install the library., (*4)

``` bash $ composer require endroid/qrcode, (*5)


## Usage ```php use Endroid\QrCode\ErrorCorrectionLevel; use Endroid\QrCode\LabelAlignment; use Endroid\QrCode\QrCode; use Symfony\Component\HttpFoundation\Response; // Create a basic QR code $qrCode = new QrCode('Life is too short to be generating QR codes'); $qrCode->setSize(300); // Set advanced options $qrCode ->setWriterByName('png') ->setMargin(10) ->setEncoding('UTF-8') ->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH) ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0]) ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]) ->setLabel('Scan the code', 16, __DIR__.'/../assets/noto_sans.otf', LabelAlignment::CENTER) ->setLogoPath(__DIR__.'/../assets/symfony.png') ->setLogoWidth(150) ->setValidateResult(false) ; // Directly output the QR code header('Content-Type: '.$qrCode->getContentType()); echo $qrCode->writeString(); // Save it to a file $qrCode->writeFile(__DIR__.'/qrcode.png'); // Create a response object $response = new Response($qrCode->writeString(), Response::HTTP_OK, ['Content-Type' => $qrCode->getContentType()]);

QR Code, (*6)

Symfony integration

Register the Symfony bundle in the kernel., (*7)

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Endroid\QrCode\Bundle\EndroidQrCodeBundle(),
    ];
}

The bundle makes use of a factory to create QR codes. The default parameters applied by the factory can optionally be overridden via the configuration., (*8)

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_path: '%kernel.root_dir%/../vendor/endroid/qrcode/assets/symfony.png'
    logo_width: 150
    validate_result: false # checks if the result is readable

The readability of a QR code is primarily determined by the size, the input length, the error correction level and any possible logo over the image. The validate_result option uses a built-in reader to validate the resulting image. This does not guarantee that the code will be readable by all readers but this helps you provide a minimum level of quality. Take note that the validator can consume quite an amount of resources and is disabled by default., (*9)

Now you can retrieve the factory from the service container and create a QR code. For instance in your controller this would look like this., (*10)

$qrCode = $this->get('endroid.qrcode.factory')->create('QR Code', ['size' => 200]);

Add the following section to your routing to be able to handle QR code URLs. This step can be skipped if you only use data URIs to display your images., (*11)

``` yml EndroidQrCodeBundle: resource: "@EndroidQrCodeBundle/Controller/" type: annotation prefix: /qrcode, (*12)


After installation and configuration, QR codes can be generated by appending the QR code text to the url followed by any of the supported extensions. ## Twig extension The bundle provides a Twig extension for generating a QR code URL, path or data URI. You can use the second argument of any of these functions to override any defaults defined by the bundle or set via your configuration. ``` twig <img src="{{ qrcode_path(message) }}" /> <img src="{{ qrcode_url(message, { writer: 'eps' }) }}" /> <img src="{{ qrcode_data_uri(message, { writer: 'svg', size: 150 }) }}" />

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., (*13)

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code., (*14)

The Versions

26/07 2016

1.7.4

1.7.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

 

code qrcode endroid qr

25/06 2016

1.7.3

1.7.3.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

 

code qrcode endroid qr

31/05 2016

1.7.2

1.7.2.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

 

code qrcode endroid qr

29/05 2016

1.7.1

1.7.1.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

 

code qrcode endroid qr

29/05 2016

1.7.0

1.7.0.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

 

code qrcode endroid qr

29/05 2016

1.6.6

1.6.6.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

17/04 2016

1.6.5

1.6.5.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

08/04 2016

1.6.4

1.6.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

07/04 2016

1.6.3

1.6.3.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

26/03 2016

1.6.2

1.6.2.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

26/03 2016

1.6.1

1.6.1.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

25/03 2016

1.6.0

1.6.0.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

01/01 2016

1.5.7

1.5.7.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

27/12 2015

1.5.6

1.5.6.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

The Development Requires

code qrcode endroid qr

17/12 2015

1.5.5

1.5.5.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

The Development Requires

code qrcode endroid qr

04/07 2015

1.5.4

1.5.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

The Development Requires

code qrcode endroid qr

25/06 2015

1.5.3

1.5.3.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

The Development Requires

code qrcode endroid qr

01/06 2015

1.5.2

1.5.2.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

12/04 2015

1.5.1

1.5.1.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

25/01 2015

1.5.0

1.5.0.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

28/12 2014

1.4.8

1.4.8.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

13/12 2014

1.4.7

1.4.7.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

13/12 2014

1.4.6

1.4.6.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

13/12 2014

1.4.5

1.4.5.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

06/08 2014

1.3.4

1.3.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

17/05 2014

1.2.4

1.2.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

18/12 2013

1.1.4

1.1.4.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

23/06 2013

1.1.3

1.1.3.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

code qrcode endroid qr

13/04 2013

1.1.2

1.1.2.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

code qrcode endroid qr

13/03 2013

1.1.1

1.1.1.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

code qrcode endroid qr

07/03 2013

1.1.0

1.1.0.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

code qrcode endroid qr

27/10 2012

1.0.0

1.0.0.0 https://github.com/endroid/QrCode

Endroid QR Code

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

code qrcode endroid qr