Search by

mail-craft / mailcraft-laravel

ajaykalavadiya

Official Laravel integration for MailCraft — a Mail transport, facade, and config publishing on top of mail-craft/mailcraft-php.

Package info

github.com/mail-craft/mailcraft-laravel

pkg:composer/mail-craft/mailcraft-laravel

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-09-25 07:43 UTC

This package is auto-updated.

Last update: 2026-09-25 07:43:26 UTC


README

Official Laravel integration for MailCraft — wraps mail-craft/mailcraft-php with a Mail transport, a facade, and config publishing.

Install

composer require mail-craft/mailcraft-laravel

Publish the config (optional — it works from env vars alone):

php artisan vendor:publish --tag=mailcraft-config
MAILCRAFT_API_KEY=sk_live_...
MAIL_MAILER=mailcraft

Usage

As a Mail transport (zero code changes)

With MAIL_MAILER=mailcraft set, every existing Mail::send(...) / Mailable / notification call routes through MailCraft automatically:

Mail::to('person@example.com')->send(new WelcomeEmail($user));

The package converts the Symfony MIME message Laravel builds into the structured fields MailCraft's API expects (from/to/subject/html/text/headers) — no raw-MIME endpoint required.

Using the client/facade directly

For anything beyond sending mail — contacts, campaigns, templates, domains, etc. — use the facade or inject the client:

use MailCraft\Laravel\Facades\MailCraft;

MailCraft::contacts()->upsert(email: 'person@example.com', firstName: 'Ada');
MailCraft::campaigns()->send($campaignId);
use MailCraft\MailCraft;

class SubscribeController
{
    public function __invoke(MailCraft $mailcraft)
    {
        $mailcraft->contacts->upsert(email: request('email'));
    }
}

Both styles reach the same underlying resources — see mail-craft/mailcraft-php's README for the full resource list.

Requirements

PHP 8.1+, Laravel 10, 11, 12, or 13.

License

MIT