uc / qrcode-bundle
Symfony 3 bundle integrate QRcode into a Symfony project
Installs: 284
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.1
- endroid/qrcode: ^2.2
- knplabs/knp-snappy-bundle: ~1.4
- sfk/email-template-bundle: dev-master
- symfony/symfony: ~3.0
This package is not auto-updated.
Last update: 2024-11-10 04:17:19 UTC
README
Installation
To install this bundle, run the command below and you will get the latest version from [Packagist][3].
@see https://github.com/Endroid/QrCode
composer require endroid/qrcode
Then enable it in your kernel:
// app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Endroid\QrCode\Bundle\EndroidQrCodeBundle(), ]; }
@see https://github.com/KnpLabs/KnpSnappyBundle
With composer, add:
{ "require": { "knplabs/knp-snappy-bundle": "~1.4" } }
Then enable it in your kernel:
// app/AppKernel.php public function registerBundles() { $bundles = array( //... new Knp\Bundle\SnappyBundle\KnpSnappyBundle(), //...
And set-up the required configuration
# app/config/config.yml knp_snappy: pdf: enabled: true binary: /usr/local/bin/wkhtmltopdf #"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\"" for Windows users options: [] image: enabled: true binary: /usr/local/bin/wkhtmltoimage #"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe\"" for Windows users options: []
composer require sfk/email-template-bundle dev-master
composer require uc/qrcode-bundle dev-master
Load required bundles in AppKernel.php:
// app/AppKernel.php public function registerBundles() { $bundles = array( // [...] new Uc\PaymentBundle\UcQCodeBundle(), ); }
Create a QRCode
/** * $vars = [ * 'code' => '' // Encode string, * 'orderId' => '' // Order ID * ] * @return string = '/uploads/tmp/orderId . date('dmY') .svg' // file location */ $QManager->generateQCode($vars = []);
Build a PDF
/** * $vars = [ * 'html' => '' //Html content which will be processed to pdf * 'name' => '' //PDF name * ] * @return array = [ * 'path' => '' //File location * 'pdf' => '' //PDF raw * ] */ $PDFManger->progressPDF($vars = []);
Send email
/** * $vars = [ * 'sender' => '' //Email sender * 'recipient' => '' //Email recipient * 'subject' => '' //Email subject * 'body' => '' //Email body * 'pdf' => '' //Attachment pdf file location * ] */ $DeliveryManager->onSendEmail($vars = []);