Wrapper for qrcode functionality.
Install the package via composer:
composer require think.studio/laravel-thinkqr
Optionally you can publish the config file with:
php artisan vendor:publish --provider="ThinkQR\ServiceProvider" --tag="config"
$qrCode = \ThinkQR\QRCode::make('foo');
// or
$qrCode = \ThinkQR\QRCode::make('foo', [
'render_size' => 300,
'margin' => 10,
]);
$qrCode->getSvgString(); // XML svg string
$qrCode->getPngString(); // Binary png string (you can encode to base64 and use as data image)
// Save Files
$qrCode->writeSvgFile('my/path/file.svg');
$qrCode->writePngFile('my/path/file.png');
Create tmp image for insert to some dynamic script like pdf.
use ThinkQR\Image\QrCodeImageForPdf;
$pdf = new Fpdi();
$pdf->Image(QrCodeImageForPdf::make('https://example.com/foo-bar-baz', [
'render_size' => 200,
'margin' => 2,
])->filePath(), 0, 0, 30);