PHP code example of akira / laravel-qrcode
1. Go to this page and download the library: Download akira/laravel-qrcode 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/ */
akira / laravel-qrcode example snippets
use Akira\QrCode\Facades\QrCode;
// Simple text
$qrCode = QrCode::text('Hello World');
// With customization
$qrCode = QrCode::size(300)
->color(255, 0, 0)
->text('https://example.com');
// WiFi network
$qrCode = QrCode::wifi([
'ssid' => 'MyNetwork',
'password' => 'secret123'
]);
// Email
$qrCode = QrCode::email('[email protected] ', 'Subject', 'Body');
// Contact card
$qrCode = QrCode::vcard([
'fullName' => 'Jane Doe',
'email' => '[email protected] '
]);
// Calendar event
$qrCode = QrCode::ical([
'summary' => 'Release planning',
'startsAt' => '2026-06-01 10:00:00 UTC',
'endsAt' => '2026-06-01 11:00:00 UTC'
]);
// Phone
$qrCode = QrCode::phone('+1234567890');
// Ethereum
$qrCode = QrCode::ethereum(
'0x0000000000000000000000000000000000000001',
'1000000000000000000'
);
// Litecoin
$qrCode = QrCode::litecoin('ltcaddress', 1.25);
// With styling
$qrCode = QrCode::size(400)
->gradient(255, 0, 0, 0, 0, 255, 'diagonal')
->style('round', 0.7)
->eye('circle')
->text('Styled QR Code');
return response()->json([
'qrcode' => base64_encode(QrCode::format('png')->generateRaw($data))
]);
$png = QrCode::format('png')->size(500)->generateRaw($data);
return response($png)
->header('Content-Type', 'image/png')
->header('Content-Disposition', 'attachment; filename="qrcode.png"');
$qrCode = QrCode::format('png')
->size(400)
->errorCorrection('H')
->merge(public_path('logo.png'), 0.2)
->text('https://example.com');
bash
php artisan vendor:publish --tag="qrcode-config"