priotas / twig-qrcode-extension
A Twig extension for embedding inline QR codes in Twig templates
Installs: 10 801
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- ext-gd: *
- endroid/qrcode: ^1.7
- twig/twig: ~1.20|~2.0
Requires (Dev)
- phpunit/phpunit: ^5.5
This package is not auto-updated.
Last update: 2020-04-28 18:47:28 UTC
README
Overview
- 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');
Available filter options
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 |