By endroid
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.
- Symfony
- Dependencies:
QrCode
{
"require": {
"endroid/qrcode-bundle": "dev-master"
}
}
$ 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.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Endroid\Bundle\QrCodeBundle\EndroidQrCodeBundle(),
);
}
Add the following section to your routing to be able to reach the controller.
EndroidQrCodeBundle:
resource: "@EndroidQrCodeBundle/Controller/"
type: annotation
prefix: /qrcode
The bundle also provides a Twig extension for quickly generating QR code urls.
<img src="{{ qrcode_url(message) }}" />
No configuration required.
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.
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.