> ## Documentation Index
> Fetch the complete documentation index at: https://laravel-qrcode.mintlify.site/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()]);
  }
  ```
</Warning>

***

## 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`.

<ParamField body="address" type="string" required>
  The primary recipient email address. Must be a valid email.
</ParamField>

<ParamField body="subject" type="string | null">
  Pre-filled subject line. Defaults to `null`.
</ParamField>

<ParamField body="body" type="string | null">
  Pre-filled message body. Defaults to `null`.
</ParamField>

<ParamField body="cc" type="string | null">
  Carbon copy address. Must be a valid email when provided.
</ParamField>

<ParamField body="bcc" type="string | null">
  Blind carbon copy address. Must be a valid email when provided.
</ParamField>

```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.

<ParamField body="phoneNumber" type="string" required>
  The phone number to dial, including country code (e.g. `+12025551234`).
</ParamField>

```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.

<ParamField body="phoneNumber" type="string | int | float" required>
  The recipient phone number, ideally in E.164 format (e.g. `+12025551234`).
</ParamField>

<ParamField body="message" type="string | null">
  Pre-filled SMS message text. Defaults to `null`.
</ParamField>

```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.

<ParamField body="latitude" type="float" required>
  Latitude in decimal degrees (e.g. `37.7749`).
</ParamField>

<ParamField body="longitude" type="float" required>
  Longitude in decimal degrees (e.g. `-122.4194`).
</ParamField>

<ParamField body="name" type="string">
  Optional human-readable place name. Defaults to an empty string.
</ParamField>

```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.

<ParamField body="credentials" type="array" required>
  An associative array describing the network:

  <Expandable title="credentials keys">
    <ParamField body="ssid" type="string" required>
      The network name (SSID). Must not be empty.
    </ParamField>

    <ParamField body="encryption" type="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.
    </ParamField>

    <ParamField body="password" type="string">
      Network password. Required when `encryption` is `WEP` or `WPA`. Must be omitted or empty when `encryption` is `NOPASS`.
    </ParamField>

    <ParamField body="hidden" type="bool">
      Set to `true` if the network does not broadcast its SSID. Defaults to `false`.
    </ParamField>
  </Expandable>
</ParamField>

<Warning>
  WEP encryption is deprecated and cryptographically broken. It is supported for
  legacy device compatibility only. Use WPA or WPA2 wherever possible.
</Warning>

<CodeGroup>
  ```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,
  ]);
  ```
</CodeGroup>

***

## 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).

<ParamField body="address" type="string" required>
  The Bitcoin wallet address. Must be a non-empty string.
</ParamField>

<ParamField body="amount" type="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.
</ParamField>

<ParamField body="label" type="string | null">
  Human-readable label for the payment destination (maps to the `label` query
  parameter).
</ParamField>

<ParamField body="message" type="string | null">
  Note attached to the payment request (maps to the `message` query parameter).
</ParamField>

<ParamField body="returnAddress" type="string | null">
  URL the wallet should redirect to after the transaction is broadcast (maps to
  the `r` query parameter).
</ParamField>

```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).

<ParamField body="address" type="string" required>
  The Ethereum wallet address (typically a `0x…` checksummed address).
</ParamField>

<ParamField body="amount" type="int | float | string | null">
  The requested amount in ETH. Omit or pass `null` for an amount-agnostic
  address QR code.
</ParamField>

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

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

***

## VCard()

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

Generate a vCard 3.0 QR code for contact sharing.

<ParamField body="properties" type="array" required>
  An associative array of contact properties:

  <Expandable title="properties keys">
    <ParamField body="name" type="string" required>
      Full display name (`FN` field). Must not be empty.
    </ParamField>

    <ParamField body="firstName" type="string">
      First name component used in the structured `N` field.
    </ParamField>

    <ParamField body="lastName" type="string">
      Last name component used in the structured `N` field.
    </ParamField>

    <ParamField body="email" type="string">
      Internet email address.
    </ParamField>

    <ParamField body="emailWork" type="string">
      Work email address (`EMAIL;type=INTERNET,WORK`).
    </ParamField>

    <ParamField body="emailHome" type="string">
      Home email address (`EMAIL;type=INTERNET,HOME`).
    </ParamField>

    <ParamField body="phone" type="string">
      General phone number.
    </ParamField>

    <ParamField body="phoneWork" type="string">
      Work phone number (`TEL;type=WORK`).
    </ParamField>

    <ParamField body="phoneHome" type="string">
      Home phone number (`TEL;type=HOME`).
    </ParamField>

    <ParamField body="phoneCell" type="string">
      Mobile phone number (`TEL;type=CELL`).
    </ParamField>

    <ParamField body="company" type="string">
      Organisation name (`ORG` field).
    </ParamField>

    <ParamField body="job" type="string">
      Job title (`TITLE` field).
    </ParamField>

    <ParamField body="role" type="string">
      Role within the organisation (`ROLE` field).
    </ParamField>

    <ParamField body="url" type="string">
      Personal or company website URL.
    </ParamField>

    <ParamField body="address" type="string">
      Postal address string.
    </ParamField>

    <ParamField body="note" type="string">
      Free-text note.
    </ParamField>

    <ParamField body="birthday" type="string">
      Birthday in `YYYYMMDD` format.
    </ParamField>
  </Expandable>
</ParamField>

```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.

<ParamField body="name" type="string" required>
  The contact's full name. Must not be empty.
</ParamField>

<ParamField body="phone" type="string | null">
  Primary phone number.
</ParamField>

<ParamField body="email" type="string | null">
  Email address.
</ParamField>

<ParamField body="url" type="string | null">
  Website URL.
</ParamField>

<ParamField body="address" type="string | null">
  Postal address.
</ParamField>

<ParamField body="reading" type="string | null">
  Phonetic reading of the name (`SOUND` field).
</ParamField>

<ParamField body="nickname" type="string | null">
  Nickname (`NICKNAME` field).
</ParamField>

<ParamField body="phone2" type="string | null">
  Secondary phone number.
</ParamField>

<ParamField body="phone3" type="string | null">
  Tertiary phone number.
</ParamField>

<ParamField body="videoPhone" type="string | null">
  Video-call number (`TEL-AV` field).
</ParamField>

<ParamField body="note" type="string | null">
  Free-text note.
</ParamField>

<ParamField body="birthday" type="string | null">
  Birthday in `YYYYMMDD` format.
</ParamField>

<ParamField body="postOfficeBox" type="string | null">
  PO box (`POBOX` field).
</ParamField>

<CodeGroup>
  ```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');
  ```
</CodeGroup>

***

## 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.

<ParamField body="attributes" type="array" required>
  <Expandable title="attributes keys">
    <ParamField body="summary" type="string" required>
      Event title. Must not be empty.
    </ParamField>

    <ParamField body="start" type="Carbon | DateTimeInterface | string | int" required>
      Event start date/time. Accepts a `Carbon` instance, any
      `DateTimeInterface`, a parseable date string, or a Unix timestamp integer.
    </ParamField>

    <ParamField body="end" type="Carbon | DateTimeInterface | string | int" required>
      Event end date/time. Must be strictly after `start`.
    </ParamField>

    <ParamField body="description" type="string">
      Optional long description of the event.
    </ParamField>

    <ParamField body="location" type="string">
      Optional venue or address string.
    </ParamField>
  </Expandable>
</ParamField>

<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.
</Note>

```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.

<ParamField body="phoneNumber" type="string | int | float" required>
  The recipient phone number, ideally in E.164 format (e.g. `+12025551234`).
  Must not be empty.
</ParamField>

<ParamField body="message" type="string | null">
  Pre-filled message text. Defaults to `null`.
</ParamField>

<CodeGroup>
  ```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');
  ```
</CodeGroup>

***

## 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.

<ParamField body="username" type="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.
</ParamField>

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

  ```php Array form theme={null}
  QrCode::Telegram(['username' => 'laravel']);
  ```
</CodeGroup>

***

## 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()]);
}
```
