PHP code example of think.studio / laravel-thinkqr

1. Go to this page and download the library: Download think.studio/laravel-thinkqr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

think.studio / laravel-thinkqr example snippets


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

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);
bash
php artisan vendor:publish --provider="ThinkQR\ServiceProvider" --tag="config"