PHPackages                             lettermint/lettermint-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lettermint/lettermint-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lettermint/lettermint-php
=========================

Official Lettermint PHP SDK.

2.2.0(1mo ago)5144.6k↑301.6%2MITPHPPHP ^8.2CI passing

Since Apr 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/lettermint/lettermint-php)[ Packagist](https://packagist.org/packages/lettermint/lettermint-php)[ Docs](https://github.com/lettermint/lettermint-php)[ RSS](/packages/lettermint-lettermint-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (44)Versions (21)Used By (2)

Lettermint PHP SDK
==================

[](#lettermint-php-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d2fc251672a469823fcb318c37e9ae165de52d9d7acfd4ff0f0963132ec956e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c65747465726d696e742f6c65747465726d696e742d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lettermint/lettermint-php)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3e97bf8347754aa96285c7f83e0af7da601b503d326e438c8c9eed2408da0969/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c65747465726d696e742f6c65747465726d696e742d7068702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/lettermint/lettermint-php/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ef32f9a4a535e5fcc21c0d57bce4c8518dd36f83d713791ca61ed21d35f9aab1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c65747465726d696e742f6c65747465726d696e742d7068702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/lettermint/lettermint-php/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c63fbd9b42b3e4e2f5768e944a792a108d7b533ce14e6323c7502d58b5beff57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65747465726d696e742f6c65747465726d696e742d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lettermint/lettermint-php)[![Join our Discord server](https://camo.githubusercontent.com/53ac78394b2bfdedbab92b06b9aa0593d5334263ac202bcb761913f2cbde04c3/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f313330353531303039353538383831393033353f6c6f676f3d646973636f7264266c6f676f436f6c6f723d656565266c6162656c3d446973636f7264266c6162656c436f6c6f723d34363463653526636f6c6f723d3044304532382663616368655365636f6e64733d3433323030)](https://lettermint.co/r/discord)

Integrate Lettermint in your PHP project.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Composer

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lettermint/lettermint-php
```

Usage
-----

[](#usage)

Initialize the Lettermint client with your Sending API token:

```
$lettermint = new Lettermint\Lettermint('your-api-token');
```

For new integrations, prefer explicit clients for the two API surfaces:

```
$email = Lettermint\Lettermint::email(getenv('LETTERMINT_SENDING_TOKEN'));
$api = Lettermint\Lettermint::api(getenv('LETTERMINT_API_TOKEN'));
```

Sending API tokens are project-specific and authenticate with the `x-lettermint-token` header. API tokens are team-scoped and authenticate with `Authorization: Bearer ...`. Keep these tokens separate and never reuse an API token for sending-only workloads.

### Sending Emails

[](#sending-emails)

The SDK provides a fluent interface for composing and sending emails:

```
$response = $lettermint->email
                       ->from('sender@example.com')
                       ->to('recipient@example.com')
                       ->subject('Hello from Lettermint!')
                       ->text('Hello! This is a test email.')
                       ->send();
```

The SDK supports various email features:

```
$lettermint->email
    ->from('John Doe ')
    ->to('recipient1@example.com', 'recipient2@example.com')
    ->cc('cc@example.com')
    ->bcc('bcc@example.com')
    ->replyTo('reply@example.com')
    ->subject('Hello world!')
    ->html('Hello!')
    ->text('Hello!')
    ->headers(['X-Custom-Header' => 'Value'])
    ->attach('document.pdf', base64_encode($fileContent))
    ->attach('logo.png', base64_encode($logoContent), 'logo@example.com')
    ->route('my-route-id')
    ->idempotencyKey('unique-request-id-123')
    ->send();
```

You can also send with an array payload:

```
$response = $email->send([
    'from' => 'sender@example.com',
    'to' => ['recipient@example.com'],
    'subject' => 'Hello from Lettermint!',
    'text' => 'Hello! This is a test email.',
]);
```

### Batch Sending

[](#batch-sending)

```
$response = $email->sendBatch([
    [
        'from' => 'sender@example.com',
        'to' => ['recipient@example.com'],
        'subject' => 'First email',
        'text' => 'Hello!',
    ],
    [
        'from' => 'sender@example.com',
        'to' => ['another@example.com'],
        'subject' => 'Second email',
        'text' => 'Hello again!',
    ],
]);
```

#### Inline Attachments

[](#inline-attachments)

You can embed images and other content in your HTML emails using content IDs:

```
$lettermint->email
    ->from('sender@example.com')
    ->to('recipient@example.com')
    ->subject('Email with inline image')
    ->html('Here is an image: ')
    ->attach('logo.png', base64_encode($imageContent), 'logo@example.com')
    ->send();
```

### Idempotency

[](#idempotency)

To ensure that duplicate requests are not processed, you can use an idempotency key:

```
$response = $lettermint->email
                       ->from('sender@example.com')
                       ->to('recipient@example.com')
                       ->subject('Hello from Lettermint!')
                       ->text('Hello! This is a test email.')
                       ->idempotencyKey('unique-request-id-123')
                       ->send();
```

The idempotency key should be a unique string that you generate for each unique email you want to send. If you make the same request with the same idempotency key, the API will return the same response without sending a duplicate email.

For more information, refer to the [documentation](https://docs.lettermint.co/platform/emails/idempotency).

### API Client

[](#api-client)

Use the API client for team-scoped resources such as projects, domains, routes, suppressions, stats, messages, and webhooks:

```
$api = Lettermint\Lettermint::api(getenv('LETTERMINT_API_TOKEN'));

$projects = $api->projects->list(['filter[search]' => 'production']);

$project = $api->projects->create([
    'name' => 'Production',
    'smtp_enabled' => false,
]);

$api->domains->verifyDnsRecords('domain-id');

$stats = $api->stats->retrieve([
    'from' => '2026-05-01',
    'to' => '2026-05-09',
]);

$api->suppressions->create([
    'email' => 'user@example.com',
    'reason' => 'manual',
    'scope' => 'team',
]);

$api->webhooks->create([
    'route_id' => 'route-id',
    'name' => 'Production webhook',
    'url' => 'https://example.com/lettermint/webhook',
    'events' => ['message.sent', 'message.delivered'],
]);
```

Both API surfaces support `ping()`:

```
$email->ping();
$api->ping();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Upgrading
---------

[](#upgrading)

Please see [UPGRADE.md](UPGRADE.md) for guidance on upgrading from v1 to v2.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Bjarn Bronsveld](https://github.com/bjarn)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance91

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 72% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~55 days

Total

16

Last Release

42d ago

Major Versions

0.1.1 → 1.0.02025-06-14

1.5.1 → 2.0.02026-05-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14638441?v=4)[Bjarn Bronsveld](/maintainers/bjarn)[@bjarn](https://github.com/bjarn)

---

Top Contributors

[![bjarn](https://avatars.githubusercontent.com/u/14638441?v=4)](https://github.com/bjarn "bjarn (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![Bjornftw](https://avatars.githubusercontent.com/u/2643275?v=4)](https://github.com/Bjornftw "Bjornftw (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![heikokrebs](https://avatars.githubusercontent.com/u/230852?v=4)](https://github.com/heikokrebs "heikokrebs (1 commits)")

---

Tags

phplettermintlettermint-php

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lettermint-lettermint-php/health.svg)

```
[![Health](https://phpackages.com/badges/lettermint-lettermint-php/health.svg)](https://phpackages.com/packages/lettermint-lettermint-php)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k55](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[oat-sa/tao-core

TAO core extension

64147.9k151](/packages/oat-sa-tao-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
