承接 webregul/laravel-sms-ru-channel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

webregul/laravel-sms-ru-channel

最新稳定版本:v2.0.0

Composer 安装命令:

composer require webregul/laravel-sms-ru-channel

包简介

Laravel sms.ru channel

README 文档

README

test Software License Quality Score StyleCI Total Downloads Codecov

Content

Installation

Install package with Composer:

composer require webregul/laravel-sms-ru-channel

Usage

Configuration

Register provider:

// config/app.php
'providers' => [
    ...
    Kafkiansky\SmsRuChannel\SmsRuProvider::class,
],

Add configuration in config/services.php:

// config/services.php

'sms_ru' => [
    'api_id' => env('SMS_RU_API_ID'),
    'login'  => env('SMS_RU_LOGIN', null),
    'password' => env('SMS_RU_PASSWORD', null),
    'partner_id' => env('SMS_RU_PARTNER', null),
    'test' => env('SMS_RU_TEST', 1),
    'json' => env('SMS_RU_JSON', 1),
    'from' => env('SMS_RU_FROM', null),
],

Read more about configuration on official site.

How to

First way

Create notification message:

use Illuminate\Notifications\Notification;
use Kafkiansky\SmsRu\Message\SmsRuMessage;
use Kafkiansky\SmsRu\Message\To;
use Kafkiansky\SmsRuChannel\SmsRuChannel;

final class RegistrationComplete extends Notification
{
    public function via($notifiable)
    {
        return [SmsRuChannel::class];
    }

    public function toSmsRu($notifiable)
    {
        return new SmsRuMessage(new To($notifiable->phone, 'Congratulations, you have become part of our application'));
    }
}

Second way

Or create routeNotificationForSmsRu method in notifiable instance:

use Illuminate\Notifications\Notifiable;

/**
 * @property string $phone
 */
class User
{
    use Notifiable;

    public function routeNotificationForSmsRu()
    {
        return $this->phone; // can be array of phone numbers
    }
}

In this case notification message should look like this:

use Illuminate\Notifications\Notification;
use Kafkiansky\SmsRuChannel\SmsRuChannel;

final class RegistrationComplete extends Notification
{
    public function via($notifiable)
    {
        return [SmsRuChannel::class];
    }

    public function toSmsRu($notifiable)
    {
        return 'Congratulations, you have become part of our application';
    }
}

Testing

$ composer test

License

The MIT License (MIT). See License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固