PHP code example of tumutech / laravel-qr-code

1. Go to this page and download the library: Download tumutech/laravel-qr-code 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/ */

    

tumutech / laravel-qr-code example snippets


use Tumutech\QrCode\Facades\QrCode;

return QrCode::size(300)->png('https://example.com');

use Tumutech\QrCode\Facades\QrCode;

Route::get('/qr', function () {
    return QrCode::size(300)->png('https://example.com');
});

return QrCode::size(400)
    ->logo(public_path('images/brand.png'))
    ->scanSafe()
    ->png('https://example.com/invite');

QrCode::logo(public_path('images/brand.png'), 88);          // custom width
QrCode::logo(public_path('images/brand.png'), null, false); // no punchout

QrCode::template('gradient-ocean')
    ->logo(public_path('images/brand.png'))
    ->scanSafe()
    ->png('https://example.com');

QrCode::module('dots', 0.8)
    ->eye('circle')
    ->color('#101824')
    ->backgroundColor('#ffffff')
    ->logo(public_path('images/brand.png'))
    ->scanSafe()
    ->png('https://example.com');

$qr = QrCode::template('gradient-ocean')
    ->logo(public_path('images/brand.png'))
    ->scanSafe();

$issues = $qr->scanSafeIssues(); // inspect without throwing

return $qr->png($url);

return Inertia::render('Ticket', [
    'qr' => QrCode::size(240)
        ->logo(public_path('images/brand.png'))
        ->scanSafe()
        ->dataUri($ticketUrl),
]);

QrCode::logo(public_path('images/brand.png'))
    ->scanSafe()
    ->store('https://example.com', 'qrs/ticket.png');

QrCode::disk('s3')->store('https://example.com', 'qrs/ticket.png');

$qr = QrCode::wifi([
    'ssid' => 'Office',
    'password' => 'secret',
]);

echo $qr->getDataUri();

QrCode::email('[email protected]', 'Subject', 'Body');
QrCode::sms('+15551234567', 'Hello');
QrCode::vcard([
    'firstName' => 'Ada',
    'lastName' => 'Lovelace',
    'organization' => 'Example',
    'phones' => ['+15551234567'],
    'emails' => ['[email protected]'],
]);
bash
php artisan vendor:publish --tag=qr-code-config
bash
sudo apt install php-gd
sudo systemctl restart php8.2-fpm   # or your PHP-FPM / Apache service
ini
extension=gd