sub100/notifications 问题修复 & 功能扩展

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

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

sub100/notifications

Composer 安装命令:

composer require sub100/notifications

包简介

Sub100 Notifications Laravel SDK

README 文档

README

This package uses Sub100 notification api to send email, sms and whatsapp notifications.

Usage as a composer package in your Laravel project

Install via composer

composer req sub100/notifications

Publish config

php artisan vendor:publish --provider="sub100\Notifications\Sub100NotificationServiceProvider"

Configure .env file

NOTIFICATION_URL=https://path-to-notification/api/
<?php

$message = new Message();
$message->subject('Subject');
$message->mailTemplate('notification.template.dir.filename');
$message->mailVariables(['name' => 'User']);
$message->addEmail('test@example.com.br');

Notification::notify($message);

Usage in another projects

Install via composer

composer req sub100/notifications
<?php

$authToken = '';

$message = new Message();
$message->message('Message text');
$message->addWhatsapp('+55 (44) 91234-5678');

$notification = new Notification('http://notification-api.example.com');

$notification->notify($message, $authToken);

Other Examples

Send Twilio Whatsapp message

<?php

$authToken = '';

$message = new Message();
$message->message('Message text');
$message->addWhatsapp('+55 (44) 91234-5678');
$message->senderServiceType('twilio');
$message->senderServiceCredentials([
    "twilio_auth_token"   => "8b74ff6655248c86fe0813e07d0f58a8",
    "twilio_account_sid"  => "AC16909ae3f38b03c7495d7dfbfd9dcbb4",
    "twilio_from"         => "whatsapp:+14155238886"
]);

$notification = new Notification('http://notification-api.example.com');

$notification->notify($message, $authToken);

Send Email with pre-defined mail body

<?php

$authToken = '';

$message = new Message();
$message->mailBody('<p>Message text</p>');
$message->addEmail('test@example.com.br');

$notification = new Notification('http://notification-api.example.com');

$notification->notify($message, $authToken);

Get notifications history

$authToken = '';

$originId = '';

$clientIds = ['',];

$notificationIds = ['',];

$notification = new Notification('http://notification-api.example.com');

$notification->historyByOrigin($originId, $authToken)

$notification->historyByClientAndOrigin($clientIds, $originId, $authToken);

$notification->historyByNotificationAndOrigin($notificationIds, $originId, $authToken)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-29