Skip to content

Latest commit

 

History

History
executable file
·
86 lines (59 loc) · 2.12 KB

README.md

File metadata and controls

executable file
·
86 lines (59 loc) · 2.12 KB

Endroid QR Code Bundle

By endroid

Build Status

This bundle provides a default controller for generating QR codes using the Endroid QR Code (endroid/QrCode) library. No configuration or extension loading is required. You only need to load the routing file.

knpbundles.com

Requirements

  • Symfony
  • Dependencies:
  • QrCode

Installation

Add in your composer.json

{
    "require": {
        "endroid/qrcode-bundle": "dev-master"
    }
}

Install the bundle

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update endroid/qrcode-bundle

Composer will install the bundle to your project's vendor/endroid directory.

Enable the bundle via the kernel

<?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 reach the controller.

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

Twig extension

The bundle also provides a Twig extension for quickly generating QR code urls.

<img src="{{ qrcode_url(message) }}" />

Configuration

No configuration required.

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. For the example given above, this would be /qrcode/Life_is_too_short_to_be_generating_qr_codes.png.

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.