承接 caherrera/laravel-notifications-infobip-omni 相关项目开发

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

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

caherrera/laravel-notifications-infobip-omni

Composer 安装命令:

composer require caherrera/laravel-notifications-infobip-omni

包简介

A custom Laravel notifications channel for Infobip API OMNI. Based on princeton255/laravel-notifications-infobip

README 文档

README

Latest Stable Version License Total Downloads

This package makes it easy to send Sms notifications using Infobip service with Laravel 5.5 and above.

Contents

Installation

You can install the package via composer:

composer require caherrera/laravel-notifications-infobip

Setting up your Infobip account

Add this settings to config/services.php:

// config/services.php
...
    'infobip' => [
        'auth'        => env('INFOBIP_AUTH','basic'),
        'username'    => env('INFOBIP_USERNAME'),
        'password'    => env('INFOBIP_PASSWORD'),
        'baseUrl'     => env('INFOBIP_BASE_URL'),
        'apikey'      => env('INFOBIP_PUBLIC_KEY'),
        'scenarioKey' => env('INFOBIP_SCENARIO_KEY'),
    ],
...

To change Base URL to personal use this (See more)

Usage

Now you can use the channel in your via() method inside the notification:

use NotificationChannels\Infobip\InfobipChannel;
use NotificationChannels\Infobip\InfobipMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [InfobipChannel::class];
    }

    public function toInfobip($notifiable)
    {
    	$message = new InfobipMessage();
		$message->setTemplateName("infobip_test_hsm");
		$message->setTemplateNamespace("whatsapp:hsm:it:infobip");
		$message->setTemplateData(["Jhon","Snow"]);
		$message->setLanguage("es");
        return $message;
    }
}

In order to let your Notification know which phone are you sending to, the channel will look for the phone_number attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForInfobip method to your Notifiable model.

public function routeNotificationForInfobip()
{
    return '+1234567890';
}

Available Message methods

InfobipMessage

  • setTemplateName(''): Accepts a string value.
  • setTemplateNamespace(''): Accepts a string value.
  • setTemplateData(['','',...]): Accepts an array of string.
  • setLanguage(''): Accepts a string value

Examples

Dispatching the notification

A. Using Laravel's notification facade

use App\Notifications\ExampleInfobipNotification;
use Illuminate\Support\Facades\Notification;

Notification::send($user, new ExampleInfobipNotification());

// where $user implements `Illuminate\Notifications\Notifiable` trait

B. Using the notify() method from Notifiable trait

use App\Notifications\ExampleInfobipNotification;

$user->notify(new ExampleInfobipNotification($invoice));

Example Notification class

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Caherrera\Laravel\Notifications\Channels\Infobip\Omni\InfobipChannel;
use Caherrera\Laravel\Notifications\Channels\Infobip\Omni\InfobipMessage;

class ExampleInfobipNotification extends Notification
{
    public function via($notifiable)
    {
        return [InfobipChannel::class];
    }

    public function toInfobip($notifiable)
    {
        $message = new InfobipMessage();
		$message->setTemplateName("infobip_test_hsm");
		$message->setTemplateNamespace("whatsapp:hsm:it:infobip");
		$message->setTemplateData(["Jhon","Snow"]);
		$message->setLanguage("es");
        return $message;
        
    }
}

Example Notifiable class

<?php

namespace App\Models;

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

class User extends Authenticatable
{
    use Notifiable;
}

For more details you can check out this link on Laravel documentation

Testing

$ ./vendor/bin/phpunit

Security

If you discover any security related issues, please help me and rise a ticket on issue tracker or simply fix it and I'll merge

Credits

License

The MIT License (MIT).

caherrera/laravel-notifications-infobip-omni 适用场景与选型建议

caherrera/laravel-notifications-infobip-omni 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 663 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 caherrera/laravel-notifications-infobip-omni 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 caherrera/laravel-notifications-infobip-omni 我们能提供哪些服务?
定制开发 / 二次开发

基于 caherrera/laravel-notifications-infobip-omni 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-12