PHPackages                             kodpreneur-dooel/sent-dm - 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. [API Development](/categories/api)
4. /
5. kodpreneur-dooel/sent-dm

ActiveLibrary[API Development](/categories/api)

kodpreneur-dooel/sent-dm
========================

Laravel integration for the Sent DM PHP SDK.

v1.0(1mo ago)00[2 PRs](https://github.com/kodpreneur-dooel/sent-dm/pulls)MITPHPPHP ^8.2CI passing

Since Jun 5Pushed 2w agoCompare

[ Source](https://github.com/kodpreneur-dooel/sent-dm)[ Packagist](https://packagist.org/packages/kodpreneur-dooel/sent-dm)[ Docs](https://github.com/kodpreneur-dooel/sent-dm)[ GitHub Sponsors]()[ RSS](/packages/kodpreneur-dooel-sent-dm/feed)WikiDiscussions main Synced 1w ago

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

Sent DM for Laravel
===================

[](#sent-dm-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a16e23c0bd370eb11163e341b26d1a9272774465c118eb1f5bc55f14f00f4f9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f647072656e6575722d646f6f656c2f73656e742d646d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kodpreneur-dooel/sent-dm)[![GitHub Tests Action Status](https://github.com/kodpreneur-dooel/sent-dm/actions/workflows/run-tests.yml/badge.svg)](https://github.com/kodpreneur-dooel/sent-dm/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://github.com/kodpreneur-dooel/sent-dm/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/kodpreneur-dooel/sent-dm/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/bac24747564c73f36368c817632239d0f48d00a43a59c98f82ccf14284919a1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f647072656e6575722d646f6f656c2f73656e742d646d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kodpreneur-dooel/sent-dm)

`kodpreneur-dooel/sent-dm` is a Laravel package for the official [Sent DM PHP SDK](https://docs.sent.dm/sdks/php). It gives Laravel apps a zero-boilerplate service provider, publishable config, container binding for the Sent SDK client, a facade, and helpers for verifying signed Sent webhooks.

The package intentionally follows the integration pattern from the Sent DM Laravel docs: configure your API key in Laravel, inject the SDK client where you send messages, and verify webhooks against the raw request body before processing events.

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 11, 12, or 13
- Sent DM API key

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

[](#installation)

Install the package with Composer:

```
composer require kodpreneur-dooel/sent-dm
```

Publish the config file:

```
php artisan vendor:publish --tag="sent-dm-config"
```

Add your Sent credentials to `.env`:

```
SENT_DM_API_KEY=your_api_key
SENT_DM_WEBHOOK_SECRET=whsec_your_webhook_secret
SENT_DM_MAX_RETRIES=2
SENT_DM_TIMEOUT=60

SENT_DM_SMS_QUEUE=default
SENT_DM_SMS_SANDBOX=false
SENT_DM_SMS_PROFILE_ID=
SENT_DM_SMS_TEMPLATE_ID=
SENT_DM_SMS_TEMPLATE_NAME=sms_notification
SENT_DM_SMS_TEMPLATE_PARAMETER=message
```

Published config:

```
return [
    'api_key' => env('SENT_DM_API_KEY'),
    'base_url' => env('SENT_DM_BASE_URL'),
    'webhook_secret' => env('SENT_DM_WEBHOOK_SECRET'),
    'max_retries' => env('SENT_DM_MAX_RETRIES', 2),
    'timeout' => env('SENT_DM_TIMEOUT', 60),

    'sms' => [
        'queue' => env('SENT_DM_SMS_QUEUE', 'default'),
        'sandbox' => env('SENT_DM_SMS_SANDBOX', false),
        'profile_id' => env('SENT_DM_SMS_PROFILE_ID'),

        'default_template' => [
            'id' => env('SENT_DM_SMS_TEMPLATE_ID'),
            'name' => env('SENT_DM_SMS_TEMPLATE_NAME', 'sms_notification'),
            'parameter' => env('SENT_DM_SMS_TEMPLATE_PARAMETER', 'message'),
        ],
    ],
];
```

The service provider is auto-discovered by Laravel.

Compatibility With Sent Docs
----------------------------

[](#compatibility-with-sent-docs)

Sent's Laravel integration guide shows a manual service provider that binds `Client::class` from `config('services.sent_dm.api_key')`. This package does that for you automatically.

By default, the package reads `config('sent-dm.api_key')`. It also falls back to `config('services.sent_dm.api_key')`, so existing apps that already follow the Sent docs can migrate without rewiring everything.

Note: the current Composer package autoloads the SDK namespace as `SentDm\Client`.

SMS Notifications
-----------------

[](#sms-notifications)

The main package feature is a Laravel notification channel named `sms`. Add `sms` to any notification's `via()` method, return a Sent DM SMS message from `toSms()`, and the package handles the rest.

```
use Codepreneur\SentDm\Messages\SentDmSmsMessage;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    public function via(object $notifiable): array
    {
        return ['mail', 'sms'];
    }

    public function toSms(object $notifiable): SentDmSmsMessage
    {
        return SentDmSmsMessage::text('Your invoice has been paid.');
    }
}
```

Your notifiable model needs an SMS route:

```
public function routeNotificationForSms(): ?string
{
    return $this->phone_number;
}
```

Then send it like any Laravel notification:

```
$user->notify(new InvoicePaid);
```

### Included SmsNotification

[](#included-smsnotification)

For quick one-off sends, use the included notification:

```
use Codepreneur\SentDm\Notifications\SmsNotification;

$user->notify(new SmsNotification('Your verification code is 123456.'));
```

You can also pass a fully configured message:

```
use Codepreneur\SentDm\Messages\SentDmSmsMessage;
use Codepreneur\SentDm\Notifications\SmsNotification;

$user->notify(new SmsNotification(
    SentDmSmsMessage::text('Your code is 123456.')
        ->sandbox()
        ->idempotencyKey('verification-'.$user->id)
));
```

### Conditional SMS Channel

[](#conditional-sms-channel)

Use `InteractsWithSentDmSms` when you want cda-v2-style behavior: include SMS only when the notifiable has a phone route, skip sending if the route is missing, and use the configured SMS queue.

```
use Codepreneur\SentDm\Concerns\InteractsWithSentDmSms;
use Codepreneur\SentDm\Messages\SentDmSmsMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class SmsOnlyNotification extends Notification implements ShouldQueue
{
    use InteractsWithSentDmSms;
    use Queueable;

    public function via(object $notifiable): array
    {
        return $this->smsChannelsFor($notifiable);
    }

    public function toSms(object $notifiable): SentDmSmsMessage
    {
        return SentDmSmsMessage::text('Hello from Sent DM.');
    }
}
```

The trait provides:

- `tries = 3`
- `backoff()` with `10`, `60`, and `300` second delays
- `smsChannelsFor($notifiable)`
- `shouldSend($notifiable, 'sms')`
- `viaQueues()` using `sent-dm.sms.queue`

### Message Builder

[](#message-builder)

`SentDmSmsMessage` supports all common SMS options:

```
SentDmSmsMessage::text('Hello')
    ->to('+38970123456')
    ->sandbox()
    ->idempotencyKey('order-123')
    ->xProfileId('profile_123');
```

Use an explicit Sent DM template:

```
SentDmSmsMessage::forTemplate(
    id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
    name: 'welcome',
    parameters: ['name' => $notifiable->name],
);
```

Or pass the template array directly:

```
SentDmSmsMessage::make()->templateArray([
    'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
    'name' => 'welcome',
    'parameters' => ['name' => 'John Doe'],
]);
```

By default, `SentDmSmsMessage::text()` uses the configured template name and parameter. Create a Sent DM template such as `sms_notification` with a single `message` variable, then set:

```
SENT_DM_SMS_TEMPLATE_NAME=sms_notification
SENT_DM_SMS_TEMPLATE_PARAMETER=message
```

If your template requires an ID, also set:

```
SENT_DM_SMS_TEMPLATE_ID=7ba7b820-9dad-11d1-80b4-00c04fd430c8
```

### Routing Options

[](#routing-options)

The channel sends to the notifiable route by default:

```
public function routeNotificationForSms(): string
{
    return '+38970123456';
}
```

You can override recipients per message:

```
public function toSms(object $notifiable): SentDmSmsMessage
{
    return SentDmSmsMessage::text('Team alert')
        ->to(['+38970123456', '+38970999888']);
}
```

Direct SDK Usage
----------------

[](#direct-sdk-usage)

Inject the official SDK client anywhere in your Laravel app:

```
use SentDm\Client;

class SendWelcomeMessage
{
    public function __construct(
        private Client $sentDm,
    ) {}

    public function handle(string $phoneNumber): string
    {
        $result = $this->sentDm->messages->send(
            to: [$phoneNumber],
            template: [
                'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
                'name' => 'welcome',
                'parameters' => [
                    'name' => 'John Doe',
                ],
            ],
            channel: ['sms', 'whatsapp', 'rcs'],
        );

        return $result->data->recipients[0]->messageID;
    }
}
```

Use sandbox mode while developing:

```
$result = $sentDm->messages->send(
    to: ['+1234567890'],
    template: [
        'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
        'name' => 'welcome',
    ],
    sandbox: true,
);
```

Facade
------

[](#facade)

The facade gives you access to the wrapper and underlying SDK client:

```
use Codepreneur\SentDm\Facades\SentDm;

$result = SentDm::client()->messages->send(
    to: ['+1234567890'],
    template: [
        'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
        'name' => 'welcome',
    ],
);
```

Webhooks
--------

[](#webhooks)

Sent signs webhook requests with these headers:

- `X-Webhook-ID`
- `X-Webhook-Timestamp`
- `X-Webhook-Signature`

Verify the raw body before parsing JSON:

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Codepreneur\SentDm\Facades\SentDm;

Route::post('/webhooks/sent', function (Request $request) {
    abort_unless(SentDm::verifyWebhookRequest($request), 401);

    $event = json_decode($request->getContent());

    if ($event?->field === 'message') {
        // Update your local message status or dispatch a job.
    }

    return response()->json(['received' => true]);
});
```

You can also verify manually:

```
$valid = SentDm::verifyWebhookSignature(
    payload: $request->getContent(),
    webhookId: $request->header('X-Webhook-ID', ''),
    timestamp: $request->header('X-Webhook-Timestamp', ''),
    signature: $request->header('X-Webhook-Signature', ''),
);
```

By default, signatures older than 5 minutes are rejected to reduce replay risk.

Laravel Boost
-------------

[](#laravel-boost)

This package requires `laravel/boost` as a development dependency and ships Boost resources for downstream Laravel apps:

- `resources/boost/guidelines/sent-dm.blade.php`
- `resources/boost/skills/sent-dm-laravel/SKILL.md`

When an app using Laravel Boost installs package guidelines or skills, AI agents can receive Sent DM-specific Laravel guidance for client injection, configuration, sandbox usage, and webhook verification.

Testing
-------

[](#testing)

```
composer test
```

Run static analysis:

```
composer analyse
```

Format code:

```
composer format
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for contribution guidelines.

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

[](#security-vulnerabilities)

Please do not report security vulnerabilities through public issues. Contact KODPRENEUR DOOEL privately at `contact@codepreneur.mk`.

Credits
-------

[](#credits)

- [KODPRENEUR DOOEL](https://github.com/kodpreneur-dooel)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0a86c135d6db93f47a4eef421bc638f33308761a872fc9f8bf789883ecd4441?d=identicon)[kodpreneur-dooel](/maintainers/kodpreneur-dooel)

---

Top Contributors

[![danielveselinov](https://avatars.githubusercontent.com/u/87199149?v=4)](https://github.com/danielveselinov "danielveselinov (7 commits)")

---

Tags

aicodepreneurlaravelmessagessentsent-dmsmssms-apisms-gatewaysms-messagingtall-stacklaravelKODPRENEUR DOOELsent-dm

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kodpreneur-dooel-sent-dm/health.svg)

```
[![Health](https://phpackages.com/badges/kodpreneur-dooel-sent-dm/health.svg)](https://phpackages.com/packages/kodpreneur-dooel-sent-dm)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M113](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

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