Download the PHP package grantholle/aliyun-sms-notification-channel without Composer
On this page you can find all versions of the php package grantholle/aliyun-sms-notification-channel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grantholle/aliyun-sms-notification-channel
More information about grantholle/aliyun-sms-notification-channel
Files in grantholle/aliyun-sms-notification-channel
Package aliyun-sms-notification-channel
Short Description Aliyun SMS Notification Channel for Laravel.
License MIT
Informations about the package aliyun-sms-notification-channel
Aliyun SMS Notification Channel
A Laravel notification channel for Aliyun's SMS product.
Installation
Configuration
It's preferred to include sensitive keys and secrets in the .env
file so that the information is not included in source control.
In your .env
file, add some keys:
In config/services.php
, add the following:
Usage
During Development
When developing your application, it may be a good idea to prevent accidentally sending SMS messages to real phone numbers. To safeguard against this, you can use the alwaysTo
function for non-production environments.
Add this snippet in your AppServiceProvider
to prevent spamming real people.
Create the Notification
Generate a new notification for your application.
Add the aliyun
channel and the toAliyunSms()
function to generate the Aliyun message. There is the template()
function to set the template ID of this message, as well as a data()
function to set the placeholders in the template.
Routing the Notification
Following the documentation, this assumes we're using the User
model. We need to add the Notifiable
trait and the routeNotificationForAliyun()
function to return the phone number.
Sending the Notification
Now in our application we can send the notification. Refer to the documentation for information on queues.
All versions of aliyun-sms-notification-channel with dependencies
ext-json Version *
alibabacloud/dysmsapi Version ^1.8
illuminate/notifications Version ~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0