Sending emails with Laravel
The notideus/laravel-notideus package bridges the notideus/notideus-php SDK into Laravel: a configurable NotideusClient singleton, a Notideus facade, a notideus mail transport, and a Notifications channel. Requires PHP 8.2+ and Laravel 10/11/12 — the service provider and facade alias are package-discovered, nothing to register manually.
Install
composer require notideus/laravel-notideus
Publish the config and set your API key:
php artisan vendor:publish --tag=notideus-config
NOTIDEUS_API_KEY=nt_live_…
Facade
All SDK resources are reachable through the Notideus facade — params and responses use snake_case exactly like the API:
use Notideus\Laravel\Facades\Notideus;
$email = Notideus::emails()->send([
'from' => 'Notideus <noreply@demo.dev>',
'to' => ['jane@example.com'],
'subject' => 'Welcome to Notideus',
'html' => '<p>Hi Jane,</p><p>Your account is ready.</p>',
'idempotency_key' => 'docs-quickstart-1',
]);
use Notideus\NotideusClient;
$notideus = new NotideusClient(config('notideus.api_key'));
$email = $notideus->emails()->send([
'from' => 'Notideus <noreply@demo.dev>',
'to' => ['jane@example.com'],
'subject' => 'Welcome to Notideus',
'html' => '<p>Hi Jane,</p><p>Your account is ready.</p>',
'idempotency_key' => 'docs-quickstart-1',
]);
contacts(), whatsapp(), unsubscribe() and plans() work the same way. Errors throw the SDK's NotideusException — see error handling in the PHP walkthrough.
Point the default mailer at the notideus transport:
MAIL_MAILER=notideus
'mailers' => [
'notideus' => [
'transport' => 'notideus',
],
],
Every Mail::send() and Mailable now rides the API — the transport maps from, to, subject and HTML (plus the text alternative and reply-to when set) onto POST /v1/emails, and derives an idempotency_key from the content so a retried send never double-sends:
use Illuminate\Support\Facades\Mail;
Mail::send([], [], function ($message) {
$message->to('jane@example.com')
->from('noreply@demo.dev', 'Notideus')
->subject('Welcome to Notideus')
->html('<p>Hi Jane,</p><p>Your account is ready.</p>');
});
Notifications
Route a notification through the NotideusChannel and define toNotideus() with the same params as a direct send — the channel fills in to from the notifiable (its routeNotificationFor('notideus'), falling back to routeNotificationFor('mail') and the email property):
use Illuminate\Notifications\Notification;
use Notideus\Laravel\Notifications\NotideusChannel;
final class WelcomeNotification extends Notification
{
/** @return array<string> */
public function via(mixed $notifiable): array
{
return [NotideusChannel::class];
}
/** @return array<string, mixed> */
public function toNotideus(mixed $notifiable): array
{
return [
'from' => 'Notideus <noreply@demo.dev>',
'subject' => 'Welcome to Notideus',
'html' => '<p>Hi Jane,</p><p>Your account is ready.</p>',
];
}
}
Return the channel's class name from via() — the provider registers no named notideus notification driver, so the bare string would fail to resolve.
What's next
- Sending emails with PHP — the underlying SDK: error handling, retries and batch sends.
- Quickstart — send your first email and replay it safely with an idempotency key.