burakaktna/laravel-vatansms

Laravel Custom Notification Channel For VatanSMS

1.0.2 2020-10-11 21:10 UTC

This package is auto-updated.

Last update: 2024-10-12 05:55:12 UTC


README

Latest Version on Packagist Total Downloads

This package makes it easy to send sms notifications with VatanSMS on Laravel.

Installation

You can install the package via composer:

composer require burakaktna/laravel-vatansms

Configuration

VATANSMS_CUSTOMER_NO=YOUR VATANSMS CUSTOMER NO
VATANSMS_USERNAME=YOUR VATANSMS USERNAME
VATANSMS_PASSWORD=YOUR VATANSMS PASSWORD
VATANSMS_ORIGINATOR=YOUR VATANSMS ORIGINATOR

Advanced configuration

Run php artisan vendor:publish --provider="Burakaktna\LaravelVatanSMS\VatanSMSServiceProvider"

/config/vatansms.php

Usage

Now you can use the channel in your via() method inside the notification:

use Burakaktna\LaravelVatanSMS\VatanSMSChannel;
use Burakaktna\LaravelVatanSMS\VatanSMSMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [VatanSMSChannel::class];
    }

    public function toVatanSMS($notifiable)
    {
        return (new VatanSMSMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}

You can also send sms with facades:

use Burakaktna\LaravelVatanSMS\Facades\VatanSMS;

function sendSms(string $content, array $number){
    VatanSMS::sendSms($content, $number)->submit();
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email burak@leafletsoft.com.tr instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.