定制 pyaesone17/sms-poh 二次开发

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

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

pyaesone17/sms-poh

最新稳定版本:1.1

Composer 安装命令:

composer require pyaesone17/sms-poh

包简介

SmsPoh Sdk for laravel

README 文档

README

https://smspoh.com/

This is my personal library to make it easier for developers. This is not offical SDK for smspoh. The main goal to create this package is I hate curl , guzzle or etc .... And I made abstraction. Now I could use easily by calling like this. That is it.

send_smspoh(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

Install

Via Composer

$ composer require pyaesone17/sms-poh:^1.1

Set Up

Publish the config file first.

$ php artisan vendor:publish

Configure the token in the sms-poh.php config file.

'token' => env('SMS_POH_TOKEN', 'Your_token_from_the_dashboard'),

SDK Usage

For fetching messages.

  1. Using Facade
$results = SmsPohFacade::fetch(1);

2.Using Container

$sms = app()->make(pyaesone17\SmsPoh\SmsPoh::class);
$results = $sms->fetch(1);

3.Using function

$resutls = fetch_smspoh(1);

For sending messages.

  1. Using Facade
$results = SmsPohFacade::send(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

$results = SmsPohFacade::send(
    '+959790646062',
    'Nice to meet you'
);

2.Using Container

$sms = app()->make(pyaesone17\SmsPoh\SmsPoh::class);
$results = $sms->send(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

3.Using function

$results = send_smspoh(
    ['+959790646062','+95943160544'],
    'Nice to meet you'
);

If you want to send message as testing purpose, you could pass true as a third parameter.

Notification Channel Usage

This package also include custom notification channel for interacting with Laravel Notification features. Here is how to use it.

class SendSmsPohNotification extends Notification
{
    use Queueable;

    public $message;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

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

    /**
     * Get the sms representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toMMSms($notifiable)
    {
        return [
            'message' => $this->message,
            'to' => '+959790646062',
            'test' => 1,
            'callback' => function (...$result)
            {
                // After sms is being sent or failed
                // The callback will fire, here you can
                // do whatever you want with the result.
                // If you don't want, just pass as null
                dd($result);
            }
        ];
    }

And Notify like this

$user = App\User::first();
$user->notify(new App\Notifications\SendSmsPohNotification("Hello world"));

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-12