shipper/laravel-winsms-channel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shipper/laravel-winsms-channel

最新稳定版本:v1.1.4

Composer 安装命令:

composer require shipper/laravel-winsms-channel

包简介

Laravel notification channel for WinSMS API

README 文档

README

Latest Version on Packagist Total Downloads

A Laravel Notification Channel to send sms notification to your users in Tunisia using WinSMS. More details here https://www.winsms.tn.

Installation

You can install the package via composer:

composer require shipper/laravel-winsms-channel

You can publish configuration file using:

php  artisan vendor:publish --provider="Shipper\WinSMS\WinSMSServiceProvider"

Usage

First, you need to create have an active winsms account. Go to https://www.winsms.tn/ and create one. Once you have access to your account, you'll need to get your API KEY. These credentials will be used to communicate with Win SMS API. Go to https://winsmspro.com/sms/user/sms-api/info

Finally, add a new service in your config/service.php file.

// file: config/winsms.php

return [
    'api_key' => env('WINSMS_API_KEY', ''),
    'sender_id' => env('WINSMS_SENDER_ID', ''),
];

Configure your notification

In your notification class, add the WinSMS Channel in the via method and create a toWinSMS method.

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Shipper\WinSMS\WinSMSChannel;
use Shipper\WinSMS\WinSMSMessage;

class ConfirmationNotification extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [WinSMSChannel::class];
    }

    // ...others method here


     /**
     * Send sms using WinSMS API
     *
     * @param mixed $notifiable
     * @return array
     */
    public function toWinSMS($notifiable):WinSMSMessage
    {
        return (new WinSMSMessage())
            ->to($notifiable->phone_number)
            ->from('MyApp')
            ->content('Your account has been created successfully');
    }
}

Available Message methods

  • to (the receiver phone number)
  • from (the sender phone number)
  • content (the actual text message)

Using Facade

You can also use the facade to send sms notification.

use Shipper\WinSMS\Facades\WinSMS;

WinSMS::sendSMS('216XXXXXXXX', 'MyApp', 'Your account has been created successfully');

License

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

统计信息

  • 总下载量: 30.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-03-08