- A Twig extension for embedding inline QR codes in Twig templates.
- The standard filter output is a DataURL string of the processed text.
composer require priotas/twig-qrcode-extension
<!-- index.html.twig -->
<!DOCTYPE html>
<html>
<body>
<img src="{{ 'http://kewl.example.com' | qrcode(size=200) }}" />
</body>
</html>
use Priotas\Twig\Extension\QrCode;
$loader = new \Twig_Loader_Filesystem(__DIR__);
$twig = new \Twig_Environment($loader);
$twig->addExtension(new QrCode());
echo $twig->render('index.html.twig');
Option | Type | Default | Description |
---|---|---|---|
type | string | png | The image type. Available types are png,eps,svg |
label | string | A label for the QR code | |
size | integer | 200 | The size of the QR code |
version | integer | auto | The version of the QR code. Range 1-40 |
svg | string | data_uri | How a SVG should be rendered. data_uri is a data:svg+xml blob. inline is an inline svg tag |