ossycodes/nigeriabulksms
Composer 安装命令:
composer require ossycodes/nigeriabulksms
包简介
This package makes it easy to send notifications via Nigeriabulksms with Laravel
README 文档
README
This package makes it easy to send notifications using Nigeriabulksms with Laravel 5 and above
Contents
- About
- Installation
- Setting up the Nigeriabulksms service
- Usage
- Security
- Contributing
- Credits
- License
About
This package makes it possible to send out Laravel notifications as a SMS using Nigeriabulksms API.
Installation
You can install this package via composer:
composer require ossycodes/nigeriabulksms
The service provider gets loaded automatically.
Setting up the Nigeriabulksms service
You will need to Register to get your username and password. Place them inside your .env file. Remember to add your Sender ID that you will be using to send the messages.
NIGERIABULKSMS_USERNAME="" NIGERIABULKSMS_PASSWORD="" NIGERIABULKSMS_SENDER=""
To load them, add this to your config/services.php . This will load the Nigeriabulksms data from the .env file.file:
'nigeriabulksms' => [ 'username' => env('NIGERIABULKSMS_USERNAME'), 'password' => env('NIGERIABULKSMS_PASSWORD'), 'sender' => env('NIGERIABULKSMS_SENDER'), ]
Add the routeNotifcationForNigeriabulksms method on your notifiable Model.
<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use Notifiable; /** * Route notifications for the Nigeriabulksms channel. * * @param \Illuminate\Notifications\Notification $notification * @return string */ public function routeNotificationForNigeriabulksms($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 NotificationChannels\Nigeriabulksms\NigeriabulksmsChannel; use NotificationChannels\Nigeriabulksms\NigeriabulksmsMessage; class NewsWasPublished extends Notification { /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return [NigeriabulksmsChannel::class]; } public function toNigeriabulksms($notifiable) { return (new NigeriabulksmsMessage()) ->setContent('Your SMS message content'); } }
Additionally you can add recipients(the phonenumber the messages will be sent to) (single value or array)
return (new NigeriabulksmsMessage("Your {$notifiable->service} was ordered!"))->setRecipients($recipients);
also you can add who the notification(sms) is sent from, this will overide the NIGERIABULKSMS_SENDER="" in your .env
return (new NigeriabulksmsMessage("Your {$notifiable->service} was ordered!"))->setFrom("name of your app");
Incase of errors from Nigeriabulksms service please do well to check Nigeriabulksms api error codes on thier developer portal
Security
If you discover any security-related issues, please email osaigbovoemmanuel1@gmail.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
How do I say Thank you?
Leave a star and follow me on Twitter .
ossycodes/nigeriabulksms 适用场景与选型建议
ossycodes/nigeriabulksms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.31k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 08 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ossycodes/nigeriabulksms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ossycodes/nigeriabulksms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-14