定制 apxcde/laravel-onfon-sms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

apxcde/laravel-onfon-sms

最新稳定版本:v0.0.1

Composer 安装命令:

composer require apxcde/laravel-onfon-sms

包简介

Add OnFon SMS to your laravel web application

README 文档

README

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require apxcde/laravel-onfon-sms

Publish the config file

You can publish the config file with:

php artisan vendor:publish --provider="Apxcde\OnfonSms\OnfonSmsServiceProvider" --tag="onfon-sms-config"

This is the contents of the published config file:

return [
    'senderId' => env('ONFON_SMS_SENDER_ID', ''),

    'api_key' => env('ONFON_SMS_API_KEY', ''),

    'client_id' => env('ONFON_SMS_CLIENT_ID', ''),

    'access_key' => env('ONFON_SMS_ACCESS_KEY', ''),
];

Add Environment Variables

Set the variables below in your .env file. You will receive these variables from onfon media

ONFON_SMS_SENDER_ID=""
ONFON_SMS_API_KEY=""
ONFON_SMS_CLIENT_ID=""
ONFON_SMS_ACCESS_KEY=""

Set up the notifiable model

Add the routeNotificationForOnfon method on your notifiable Model. If this is not added, the phone_number field will be automatically used.

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the OnFon channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForOnfon($notification)
    {
        return $this->phone;
    }
}

Usage

To use this package, you need to create a notification class, like NewsWasPublished from the example below, in your Laravel application. Make sure to check out Laravel's documentation for this process.

<?php

use Apxcde\OnfonSms\OnfonChannel;
use Apxcde\OnfonSms\OnfonMessage;

class NewsWasPublished extends Notification
{

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

    public function toOnfon($notifiable)
    {
		return (new OnfonMessage())
                    ->content('Your SMS message content');

    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover any security-related issues, please email erick@apexcode.dev instead of using the issue tracker.

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-10-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固