For the complete documentation index, see llms.txt. This page is also available as Markdown.

Notification channel

You can send SMS messages using Laravel notifications with the simpay channel.

Set default override (sender name) in your .env file:

SIMPAY_SENDING_OVERRIDE=YOUR_APPROVED_OVERRIDE

Add toSimPay method to your notification:

use Illuminate\Notifications\Notification;
use SimPay\Laravel\Notifications\SimPayMessage;

class OrderShipped extends Notification
{
    public function via(object $notifiable): array
    {
        return ['simpay'];
    }

    public function toSimPay(object $notifiable): SimPayMessage|string
    {
        // plain string is treated as content
        return 'Your order has been shipped!';

        // or with custom override and control
        return new SimPayMessage(
            content: 'Your order has been shipped!',
            override: 'SimPay', // optional, defaults to SIMPAY_SENDING_OVERRIDE
            control: 'your own value (optional)',
        );
    }
}

Add routeNotificationForSimpay method to your notifiable model. Phone number must be in format 48XXXXXXXXX:

If it returns null, message is not sent.

You can also send notification to any phone number:

Response of the channel (available in NotificationSent event) will be SendingQueuedResponse.

SimPay\Laravel\Exceptions\SimPayException will be thrown if message cannot be sent (see Send message) or override is not set.

Last updated