aankhijhyaal/laravel-sparrow

SparrowSMS notification channel for laravel

1.0.0 2021-02-04 08:17 UTC

This package is auto-updated.

Last update: 2024-09-16 13:51:49 UTC


README

This package makes it easy to send sms notification using SparrowSms API with Laravel.

Installation

You can install the package via composer:

composer require aankhijhyaal/laravel-sparrow

Setting up your Credentials

Publish the configuration file

php artisan vendor:publish --tag=laravel-sparrow

Configure your SparrowSms API Credentials:

// config/sparrow.php
'url' => <endpoint of sparrow sms API>,
'token' => <token generated from sparrow sms website>,
'identity'=><provided by sparrow sms>

Usage

You can now use the channel in your via() method inside the Notification class.

Text Notification

use Aankhijhyaal\LaraSparrow\SmsMessage;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    public function via($notifiable)
    {
        return ['sparrow'];
    }

    public function toSparrow($notifiable)
    {
        return (new SmsMessage())
                ->setContent("Your message.")
                ->setRecipient($notifiable->phone);
    }
}

License

The MIT License (MIT).