Skip to main content
Data type methods are shorthand helpers that format a structured payload according to the relevant standard and immediately pass it to generate(), returning a QrCodeResult directly. You can chain any styling methods before calling a data type method.
Every data type method validates its inputs and throws a subclass of InvalidDataTypeArgumentException when something is wrong (empty required field, invalid format, etc.). Wrap calls that consume dynamic user input in a try/catch block.
use Linkxtr\QrCode\Exceptions\InvalidDataTypeArgumentException;

try {
    $qr = QrCode::Email($request->email, $request->subject);
} catch (InvalidDataTypeArgumentException $e) {
    return back()->withErrors(['qr' => $e->getMessage()]);
}

Email()

QrCode::Email(
    string $address,
    ?string $subject = null,
    ?string $body = null,
    ?string $cc = null,
    ?string $bcc = null,
): QrCodeResult
Generate a mailto: QR code. The address, cc, and bcc values are validated with FILTER_VALIDATE_EMAIL; an invalid value throws InvalidEmailArgumentException.
address
string
required
The primary recipient email address. Must be a valid email.
subject
string | null
Pre-filled subject line. Defaults to null.
body
string | null
Pre-filled message body. Defaults to null.
cc
string | null
Carbon copy address. Must be a valid email when provided.
bcc
string | null
Blind carbon copy address. Must be a valid email when provided.
QrCode::Email(
    'support@example.com',
    'Hello from Laravel',
    'I would like to get in touch.',
    'manager@example.com'
);

PhoneNumber()

QrCode::PhoneNumber(string $phoneNumber): QrCodeResult
Generate a tel: QR code that opens the device dialler.
phoneNumber
string
required
The phone number to dial, including country code (e.g. +12025551234).
QrCode::PhoneNumber('+12025551234');

SMS()

QrCode::SMS(string|int|float $phoneNumber, ?string $message = null): QrCodeResult
Generate an sms: QR code that opens the device SMS app.
phoneNumber
string | int | float
required
The recipient phone number, ideally in E.164 format (e.g. +12025551234).
message
string | null
Pre-filled SMS message text. Defaults to null.
QrCode::SMS('+12025551234', 'Your verification code is 9182.');

Geo()

QrCode::Geo(float $latitude, float $longitude, string $name = ''): QrCodeResult
Generate a geo: QR code encoding a geographic coordinate. Scanners open the device map application at the given location.
latitude
float
required
Latitude in decimal degrees (e.g. 37.7749).
longitude
float
required
Longitude in decimal degrees (e.g. -122.4194).
name
string
Optional human-readable place name. Defaults to an empty string.
QrCode::Geo(37.7749, -122.4194, 'San Francisco, CA');

WiFi()

QrCode::WiFi(array $credentials): QrCodeResult
Generate a WiFi network configuration QR code. Scanning it lets devices join the network without manually entering credentials.
credentials
array
required
An associative array describing the network:
WEP encryption is deprecated and cryptographically broken. It is supported for legacy device compatibility only. Use WPA or WPA2 wherever possible.
QrCode::WiFi([
    'ssid'       => 'OfficeNetwork',
    'encryption' => 'WPA2',
    'password'   => 's3cur3P@ssw0rd',
]);

BTC()

QrCode::BTC(
    string $address,
    float|string $amount,
    ?string $label = null,
    ?string $message = null,
    ?string $returnAddress = null,
): QrCodeResult
Generate a Bitcoin payment request QR code using the bitcoin: URI scheme (BIP 21).
address
string
required
The Bitcoin wallet address. Must be a non-empty string.
amount
float | string
required
The requested amount in BTC (e.g. 0.005). Must be a non-negative numeric value. Pass as a string for very small amounts to avoid floating-point precision issues.
label
string | null
Human-readable label for the payment destination (maps to the label query parameter).
message
string | null
Note attached to the payment request (maps to the message query parameter).
returnAddress
string | null
URL the wallet should redirect to after the transaction is broadcast (maps to the r query parameter).
QrCode::BTC(
    address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
    amount:  0.005,
    label:   'Donation',
    message: 'Thanks for your support!',
);

Ethereum()

QrCode::Ethereum(string $address, int|float|string|null $amount = null): QrCodeResult
Generate an Ethereum payment request QR code using the ethereum: URI scheme (ERC-67).
address
string
required
The Ethereum wallet address (typically a 0x… checksummed address).
amount
int | float | string | null
The requested amount in ETH. Omit or pass null for an amount-agnostic address QR code.
QrCode::Ethereum('0x742d35Cc6634C0532925a3b8D4B2CE1e5BFB043d', 1.5);

VCard()

QrCode::VCard(array $properties): QrCodeResult
Generate a vCard 3.0 QR code for contact sharing.
properties
array
required
An associative array of contact properties:
QrCode::VCard([
    'name'      => 'Jane Smith',
    'firstName' => 'Jane',
    'lastName'  => 'Smith',
    'email'     => 'jane@example.com',
    'phone'     => '+12025551234',
    'company'   => 'Acme Corp',
    'job'       => 'Senior Engineer',
    'url'       => 'https://janesmith.dev',
]);

MeCard()

QrCode::MeCard(
    string $name,
    ?string $phone = null,
    ?string $email = null,
    ?string $url = null,
    ?string $address = null,
    ?string $reading = null,
    ?string $nickname = null,
    ?string $phone2 = null,
    ?string $phone3 = null,
    ?string $videoPhone = null,
    ?string $note = null,
    ?string $birthday = null,
    ?string $postOfficeBox = null,
): QrCodeResult
Generate a MeCard QR code — a lighter contact format popular in Japan and supported by most mobile QR scanners. You may also pass a single associative array using these parameter names as keys.
name
string
required
The contact’s full name. Must not be empty.
phone
string | null
Primary phone number.
email
string | null
Email address.
url
string | null
Website URL.
address
string | null
Postal address.
reading
string | null
Phonetic reading of the name (SOUND field).
nickname
string | null
Nickname (NICKNAME field).
phone2
string | null
Secondary phone number.
phone3
string | null
Tertiary phone number.
videoPhone
string | null
Video-call number (TEL-AV field).
note
string | null
Free-text note.
birthday
string | null
Birthday in YYYYMMDD format.
postOfficeBox
string | null
PO box (POBOX field).
QrCode::MeCard(
    name:     'Jane Smith',
    phone:    '+12025551234',
    email:    'jane@example.com',
    url:      'https://janesmith.dev',
    address:  '123 Main St',
    note:     'Laravel developer',
    birthday: '19900115',
);

CalendarEvent()

QrCode::CalendarEvent(array $attributes): QrCodeResult
Generate a vCalendar (iCalendar / .ics) QR code for a single event. Scanners open the native calendar application and pre-fill a new event.
attributes
array
required
Per RFC 5545, the generated iCalendar payload includes a DTSTAMP property set to the current UTC timestamp at the moment of generation. Two calls for the same event will therefore produce different binary output and cannot be byte-for-byte cached. Generate CalendarEvent QR codes at request time rather than caching the raw bytes.
use Carbon\Carbon;

QrCode::CalendarEvent([
    'summary'     => 'Laracon US 2025',
    'description' => 'The official Laravel conference.',
    'location'    => 'Nashville, TN',
    'start'       => Carbon::create(2025, 7, 14, 9, 0, 0, 'America/Chicago'),
    'end'         => Carbon::create(2025, 7, 16, 17, 0, 0, 'America/Chicago'),
]);

WhatsApp()

QrCode::WhatsApp(string|int|float $phoneNumber, ?string $message = null): QrCodeResult
Generate a https://wa.me/ deep-link QR code that opens a WhatsApp chat. You may also pass a single associative array using phoneNumber and message as keys. The leading + is stripped automatically.
phoneNumber
string | int | float
required
The recipient phone number, ideally in E.164 format (e.g. +12025551234). Must not be empty.
message
string | null
Pre-filled message text. Defaults to null.
QrCode::WhatsApp('+12025551234', 'Hello from Laravel!');

Telegram()

QrCode::Telegram(string $username): QrCodeResult
Generate a https://t.me/ deep-link QR code that opens a Telegram profile or channel.
username
string
required
The Telegram username. The leading @ is stripped automatically if present. Must be 5–32 characters long, start with a letter, and contain only letters, digits, and underscores — following Telegram’s username rules. You can also pass an associative array with a username key.
QrCode::Telegram('laravel');
// or
QrCode::Telegram('@laravel');

Chaining styling with data types

Because all styling methods return a cloned Generator, you can apply size, color, and style options before calling any data type method:
use Linkxtr\QrCode\Facades\QrCode;
use Linkxtr\QrCode\Exceptions\InvalidDataTypeArgumentException;
use Carbon\Carbon;

try {
    // Styled WiFi QR
    $wifi = QrCode::size(300)
        ->style('dot')
        ->color(15, 23, 42)
        ->backgroundColor(248, 250, 252)
        ->WiFi([
            'ssid'       => 'OfficeWiFi',
            'encryption' => 'WPA2',
            'password'   => 'secr3t!',
        ]);

    // Styled calendar QR
    $event = QrCode::size(350)
        ->errorCorrection('Q')
        ->gradient('#4f46e5', '#7c3aed', 'vertical')
        ->CalendarEvent([
            'summary' => 'Team Standup',
            'start'   => Carbon::now()->addDay()->setTime(9, 0),
            'end'     => Carbon::now()->addDay()->setTime(9, 30),
        ]);

} catch (InvalidDataTypeArgumentException $e) {
    logger()->error('Invalid QR payload', ['error' => $e->getMessage()]);
}