Skip to content

Sysvale/laravel-notification-smsdev

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSDev notifications channel for Laravel

This package makes it easy to send notifications using SMSDev with Laravel.

Buy Me A Coffee

Contents

Installation

This package can be installed via composer:

composer require lucasgiovanny/laravel-notification-smsdev

Setting up the SMSDev service

  1. Add the API key to the services.php config file:
// config/services.php

...

'smsdev'  => [

'api_key'  =>  env('SMSDEV_API_KEY')

],

...
  1. Add you API Key from SMSDev to your .env file

Usage

  1. First you need to add the function routeNotificationFor in the User model:
	public function routeNotificationFor()
	{
		return $this->phone_number; //replace with the phone number field you have in your model
	}
  1. Now, you can use this channel by adding SmsDevChannel::class to the array in the via() method of your notification class. You need to add the toSmsdev() method which should return a new SmsDevMessage() object.
<?php

namespace  App\Notifications;

use  Illuminate\Notifications\Notification;
use  lucasgiovanny\SmsDev\SmsDevChannel;
use  lucasgiovanny\SmsDev\SmsDevMessage;

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

	public  function  toSmsdev() {
		return (new  SmsDevMessage('Invoice paid!'));
	}
}

Available Message methods

  • getPayloadValue($key): Returns payload value for a given key.

  • content(string $message): Sets SMS message text.

  • to(string $number): Set manually the recipients number (international format).

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email lucasgiovanny@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

About

Laravel notification package to use SMSDev SMS service.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%