> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linkx.tr/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Type Methods — Structured QR Code Payloads

> Generate standards-compliant QR codes for email, phone, SMS, WiFi, vCard, crypto wallets, calendar events, WhatsApp, Telegram, and more.

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.

> [!WARNING]
>
> 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.
>
> ```php theme={null}
> use Linkxtr\QrCode\Exceptions\InvalidDataTypeArgumentException;
>
> try {
>     $qr = QrCode::Email($request->email, $request->subject);
> } catch (InvalidDataTypeArgumentException $e) {
>     return back()->withErrors(['qr' => $e->getMessage()]);
> }
> ```

***

## Email()

```php theme={null}
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.

```php theme={null}
QrCode::Email(
    'support@example.com',
    'Hello from Laravel',
    'I would like to get in touch.',
    'manager@example.com'
);
```

***

## PhoneNumber()

```php theme={null}
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`).

```php theme={null}
QrCode::PhoneNumber('+12025551234');
```

***

## SMS()

```php theme={null}
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`.

```php theme={null}
QrCode::SMS('+12025551234', 'Your verification code is 9182.');
```

***

## Geo()

```php theme={null}
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.

```php theme={null}
QrCode::Geo(37.7749, -122.4194, 'San Francisco, CA');
```

***

## WiFi()

```php theme={null}
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:

**credentials keys**

**ssid** `string` *required*

The network name (SSID). Must not be empty.

**encryption** `string`

Security protocol. Accepted values: `WEP`, `WPA`, `WPA2`, `WPA3`, `NOPASS`. `WPA2` and `WPA3` are normalised to `WPA` internally. Defaults to `WPA` when a password is provided and `NOPASS` otherwise.

**password** `string`

Network password. Required when `encryption` is `WEP` or `WPA`. Must be omitted or empty when `encryption` is `NOPASS`.

**hidden** `bool`

Set to `true` if the network does not broadcast its SSID. Defaults to `false`.

> [!WARNING]
>
> WEP encryption is deprecated and cryptographically broken. It is supported for
> legacy device compatibility only. Use WPA or WPA2 wherever possible.

```php WPA2 network theme={null}
QrCode::WiFi([
    'ssid'       => 'OfficeNetwork',
    'encryption' => 'WPA2',
    'password'   => 's3cur3P@ssw0rd',
]);
```

```php Open (password-free) network theme={null}
QrCode::WiFi([
    'ssid'       => 'GuestWiFi',
    'encryption' => 'NOPASS',
]);
```

```php Hidden network theme={null}
QrCode::WiFi([
    'ssid'       => 'HiddenNet',
    'encryption' => 'WPA',
    'password'   => 'secret',
    'hidden'     => true,
]);
```

***

## BTC()

```php theme={null}
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).

```php theme={null}
QrCode::BTC(
    address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
    amount:  0.005,
    label:   'Donation',
    message: 'Thanks for your support!',
);
```

***

## Ethereum()

```php theme={null}
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.

```php With amount theme={null}
QrCode::Ethereum('0x742d35Cc6634C0532925a3b8D4B2CE1e5BFB043d', 1.5);
```

```php Address only theme={null}
QrCode::Ethereum('0x742d35Cc6634C0532925a3b8D4B2CE1e5BFB043d');
```

***

## VCard()

```php theme={null}
QrCode::VCard(array $properties): QrCodeResult
```

Generate a vCard 3.0 QR code for contact sharing.

**properties** `array` *required*

An associative array of contact properties:

**properties keys**

**name** `string` *required*

Full display name (`FN` field). Must not be empty.

**firstName** `string`

First name component used in the structured `N` field.

**lastName** `string`

Last name component used in the structured `N` field.

**email** `string`

Internet email address.

**emailWork** `string`

Work email address (`EMAIL;type=INTERNET,WORK`).

**emailHome** `string`

Home email address (`EMAIL;type=INTERNET,HOME`).

**phone** `string`

General phone number.

**phoneWork** `string`

Work phone number (`TEL;type=WORK`).

**phoneHome** `string`

Home phone number (`TEL;type=HOME`).

**phoneCell** `string`

Mobile phone number (`TEL;type=CELL`).

**company** `string`

Organisation name (`ORG` field).

**job** `string`

Job title (`TITLE` field).

**role** `string`

Role within the organisation (`ROLE` field).

**url** `string`

Personal or company website URL.

**address** `string`

Postal address string.

**note** `string`

Free-text note.

**birthday** `string`

Birthday in `YYYYMMDD` format.

```php theme={null}
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()

```php theme={null}
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).

```php Named arguments theme={null}
QrCode::MeCard(
    name:     'Jane Smith',
    phone:    '+12025551234',
    email:    'jane@example.com',
    url:      'https://janesmith.dev',
    address:  '123 Main St',
    note:     'Laravel developer',
    birthday: '19900115',
);
```

```php Name only theme={null}
QrCode::MeCard('Jane Smith');
```

***

## CalendarEvent()

```php theme={null}
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*

**attributes keys**

**summary** `string` *required*

Event title. Must not be empty.

**start** `Carbon | DateTimeInterface | string | int` *required*

Event start date/time. Accepts a `Carbon` instance, any
`DateTimeInterface`, a parseable date string, or a Unix timestamp integer.

**end** `Carbon | DateTimeInterface | string | int` *required*

Event end date/time. Must be strictly after `start`.

**description** `string`

Optional long description of the event.

**location** `string`

Optional venue or address string.

> [!NOTE]
>
> 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.

```php theme={null}
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()

```php theme={null}
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`.

```php String with message theme={null}
QrCode::WhatsApp('+12025551234', 'Hello from Laravel!');
```

```php Array form theme={null}
QrCode::WhatsApp([
    'phoneNumber' => '+12025551234',
    'message'     => 'Hello from Laravel!',
]);
```

```php Number only theme={null}
QrCode::WhatsApp('+12025551234');
```

***

## Telegram()

```php theme={null}
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.

```php String form theme={null}
QrCode::Telegram('laravel');
// or
QrCode::Telegram('@laravel');
```

```php Array form theme={null}
QrCode::Telegram(['username' => '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:

```php theme={null}
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()]);
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.