PHPackages                             shaffe/laravel-dkim - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. shaffe/laravel-dkim

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

shaffe/laravel-dkim
===================

Laravel package to add DKIM signatures to outgoing emails

v1.0.0(2mo ago)06MITPHPPHP ^8.1

Since Mar 3Pushed 2mo agoCompare

[ Source](https://github.com/shaffe-fr/laravel-dkim)[ Packagist](https://packagist.org/packages/shaffe/laravel-dkim)[ RSS](/packages/shaffe-laravel-dkim/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel DKIM
============

[](#laravel-dkim)

A drop-in Laravel package that automatically signs all outgoing emails with DKIM. No changes to your existing Mailables, Notifications, or any mail-sending code required — just install, configure your key, and every email gets signed transparently.

Uses Symfony's built-in `DkimSigner` under the hood.

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

[](#installation)

```
composer require shaffe/laravel-dkim
```

The service provider is auto-discovered via the `composer.json` extra configuration.

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=dkim-config
```

Add these variables to your `.env`:

```
DKIM_ENABLED=true
DKIM_PRIVATE_KEY=/path/to/your/private.key
DKIM_DOMAIN=example.com
DKIM_SELECTOR=my-selector
DKIM_PASSPHRASE=
```

`DKIM_PRIVATE_KEY` accepts either a path to a PEM key file or the raw PEM key as a string.

Choosing a Selector
-------------------

[](#choosing-a-selector)

We recommend using a custom selector instead of `default`. The default DKIM key (`default._domainkey.example.com`) is often managed by your hosting panel (Plesk, cPanel, etc.) and may be regenerated during system upgrades or configuration changes — which would silently break your application's DKIM signing.

Using a dedicated selector like `laravel`, or `app-mail` gives you several advantages:

- Your key is independent from the system-managed one and won't be affected by server-side changes.
- It clearly identifies the source of signed emails (useful when multiple services send from the same domain).
- You can rotate or revoke the key without impacting other services.

Key Generation
--------------

[](#key-generation)

Generate a dedicated key pair for your selector:

```
openssl genrsa -out my-selector.dkim.private 2048
openssl rsa -in my-selector.dkim.private -out my-selector.dkim.public -pubout -outform PEM
```

DNS Setup
---------

[](#dns-setup)

Add a TXT record for your selector on the sending domain:

```
my-selector._domainkey.example.com  IN  TXT  "v=DKIM1; k=rsa; s=email; p="

```

The `p=` value is the content of your public key file, without the `-----BEGIN/END PUBLIC KEY-----` lines and without line breaks.

Verifying Your DNS Record
-------------------------

[](#verifying-your-dns-record)

You can verify that your DKIM DNS record is correctly set up using [MXToolbox](https://mxtoolbox.com/SuperTool.aspx):

```
https://mxtoolbox.com/SuperTool.aspx?action=dkim:example.com:my-selector&run=toolpage

```

Replace `example.com` with your domain and `my-selector` with your chosen selector.

How It Works
------------

[](#how-it-works)

The package hooks into Laravel's mail pipeline by listening to `\Illuminate\Mail\Events\MessageSending`. This event fires right before any email is handed off to the transport, so every email sent through Laravel's mailer (Mailables, Notifications, `Mail::raw()`, etc.) is automatically signed — without touching a single line of your existing code.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance93

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

67d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69542006c81a06197d5a15f1b350392dad178d77eb2a900ba6c043fffedf44e?d=identicon)[shaffe](/maintainers/shaffe)

---

Top Contributors

[![shaffe-fr](https://avatars.githubusercontent.com/u/3834222?v=4)](https://github.com/shaffe-fr "shaffe-fr (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shaffe-laravel-dkim/health.svg)

```
[![Health](https://phpackages.com/badges/shaffe-laravel-dkim/health.svg)](https://phpackages.com/packages/shaffe-laravel-dkim)
```

###  Alternatives

[fedeisas/laravel-mail-css-inliner

Inline the CSS of your HTML emails using Laravel

5974.6M3](/packages/fedeisas-laravel-mail-css-inliner)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[illuminate/notifications

The Illuminate Notifications package.

483.0M963](/packages/illuminate-notifications)[illuminate/mail

The Illuminate Mail package.

5910.1M390](/packages/illuminate-mail)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[therobfonz/laravel-mandrill-driver

Mandrill Driver for Laravel

773.5M](/packages/therobfonz-laravel-mandrill-driver)

PHPackages © 2026

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