think.studio/laravel-thinkqr

Wrapper for qrcode functionality.

1.1.0 2023-09-04 18:18 UTC

This package is auto-updated.

Last update: 2024-11-04 21:02:12 UTC


README

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Wrapper for qrcode functionality.

Installation

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"

Usage

$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);

Credits

  • Think Studio