Package Data | |
---|---|
Maintainer Username: | topcu |
Maintainer Contact: | hctopcu@gmail.com (Toplusms Laravel) |
Package Create Date: | 2017-04-17 |
Package Last Update: | 2017-04-25 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2025-02-08 15:02:15 |
Package Statistics | |
---|---|
Total Downloads: | 115 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This is a simple Notifications channel for Laravel.
First, you'll need to require the package with Composer:
composer require topcu/toplusmslaravel
Aftwards, run composer update
from your command line.
Then, update config/app.php
by adding an entry for the service provider.
'providers' => [
// ...
Topcu\TopluSms\TopluSmsProvider::class,
];
Then, update config/services.php
by adding your toplusms credentials.
return [
// ...
,
'toplusms' => [
'username' => env('TOPLUSMS_USERNAME'),
'password' => env('TOPLUSMS_PASSWORD'),
'from' => env('TOPLUSMS_FROM', null), // Can be ovverdiden with $message->from()
]
// ...
];
In order to send sms messages, you need to specify recipient for each notifiable entity.
For instance in app/user.php
// ...
public function routeNotificationForSms(){
return $this->phone;
}
// ...
In your notification class you can define channel as:
// ...
public function via($notifiable)
{
return ['sms'];
}
// ...
You also need to define, toSms
method. You can:
// ...
public function toSms($notifiable)
{
return "Hello World!";
}
// ...
// ...
public function toSms($notifiable)
{
$message = new SmsMessage("Hello World");
$message->from("5xxxxxxxxx");
return $message;
}
// ...