2017 © Pedro Peláez
 

library qrcode-bundle

Endroid Qr Code Bundle for Symfony

image

lautr/qrcode-bundle

Endroid Qr Code Bundle for Symfony

  • Tuesday, April 7, 2015
  • by lautr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,233 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 29 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

Endroid QR Code Bundle

By endroid, (*1)

Latest Stable Version Build Status Latest Stable Version Total Downloads License PayPayl donate button, (*2)

This bundle provides a default controller for generating QR codes using the Endroid QR Code (endroid/QrCode) library., (*3)

knpbundles.com, (*4)

Fork

This forks implements some barcode functionality, (*5)

Requirements

Installation

Use Composer to install the bundle., (*6)

``` bash $ composer require endroid/qrcode-bundle, (*7)


Then enable the bundle via the kernel. ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Endroid\Bundle\QrCodeBundle\EndroidQrCodeBundle(), ); }

Routing

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

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


## Configuration The default QR code generation parameters can be overridden via the configuration. All parameters are optional. ### config.yml ```yaml endroid_qr_code: size: 100 padding: 10 extension: gif error_correction_level: high foreground_color: { r: 0, g: 0, b: 0, a: 0 } background_color: { r: 255, g: 255, b: 255, a: 0 } label: "My label" labelFontSize: 16

Alpha channel available range is [0, 127] in foreground and background colors., (*10)

Twig extension

QR Codes

The bundle also provides a Twig extension for quickly generating QR code urls. Optional parameters are extension, size, padding and errorCorrectionLevel. When a parameter is omitted, the value in the bundle configuration is used., (*11)

``` twig , (*12)


You can also use the data URI helper to embed the QR code within your HTML instead of requiring a separate HTTP request to load your image. ``` twig <img src="{{ qrcode_data_uri(message, size=200, padding=10) }}" />

Bar Codes

twig <img src="{{ barcode_url(message) }}" /> <img src="{{ barcode_url(message, extension='png') }}" /> <img src="{{ barcode_url(message, size=150) }}" /> <img src="{{ barcode_url(message, type='Code128') }}" />, (*13)

Usage

After installation and configuration, QR codes can be generated by appending the QR code text to the url as mounted, followed by .png, .jpg or .gif., (*14)

QR Code, (*15)

Versioning

Semantic versioning (semver) is applied., (*16)

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

The Versions