djunehor/laravel-sms 问题修复 & 功能扩展

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

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

djunehor/laravel-sms

Composer 安装命令:

composer require djunehor/laravel-sms

包简介

Send SMS from your laravel application

README 文档

README

CircleCI Latest Stable Version Total Downloads License StyleCI Build Status Scrutinizer Code Quality Code Coverage

Laravel SMS allows you to send SMS from your Laravel application using one of over 10 sms providers, or your own sms provider.

Requirements

  • PHP >=7.1

Installation

Step 1

You can install the package via composer:

composer require djunehor/laravel-sms

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Laravel 5.4 and older

In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:

'providers' => [
    // ...
    Djunehor\Sms\SmsServiceProvider::class,
];

Lumen

After installing the package, you will have to register it in bootstrap/app.php file manually:

// Register Service Providers
    // ...
    $app->register(Djunehor\Sms\SmsServiceProvider::class);
];

Env Keys

SMS_SENDER=

BETASMS_USERNAME=
BETASMS_PASSWORD=

BULK_SMS_NIGERIA_TOKEN=
BULK_SMS_NIGERIA_DND=

GOLD_SMS_247_USERNAME=
GOLD_SMS_247_PASSWORD=

MULTITEXTER_USERNAME=
MULTITEXTER_PASSWORD=

SMART_SMS_TOKEN=

XWIRELESS_API_KEY=
XWIRELESS_CLIENT_ID=

NEXMO_API_KEY=
NEXMO_API_SECRET=

RING_CAPTCHA_APP_KEY=
RING_CAPTCHA_API_KEY=
RING_CAPTCHA_APP_SECRET=

AFRICASTALKING_API_KEY=
AFRICASTALKING_USERNAME=

NIGERIAN_BULK_SMS_USERNAME=
NIGERIAN_BULK_SMS_PASSWORD=

KUDI_SMS_USERNAME=
KUDI_SMS_PASSWORD=

MEBO_SMS_API_KEY=

SMSLIVE247_TOKEN=

INFOBIP_BASE_URL=
INFOBIP_USERNAME=
INFOBIP_PASSWORD=

Step 2 - Publishing files

Run: php artisan vendor:publish --tag=laravel-sms This will move the migration file, seeder file and config file to your app. You can set your sms details in the config file or via env

Step 3 - Adding SMS credentials

  • Add the env keys to your .env file
  • Or edit the config/laravel-sms.php file

Usage

//using betaSMS
use Djunehor\Sms\BetaSms;

$sms = new BetaSms();
$sms->text($message)->to(08135087966)->from('MyLaravel')->send();
//returns true if everything went fine. Or false if error occured.
//You can get exception via getException() or get the server response via getResponse()
//exceptions will be logged in your laravel log file

Using Helper function

//MeboSms
$send = send_sms($message, $to, $from, MeboSms::class); //returns true/false

The default SMS provider is Nexmo. You can set the default SMS provider in config/laravel-sms.php e.g 'default' => \Djunehor\Sms\Concrete\SmartSmsSolutions::class,, so you can use the helper function like this:

$send = send_sms($message, $to);
//$from is optional and is better set in the config

Available SMS Providers

Provider URL Tested
Nexmo https://developer.nexmo.com/api/sms#send-an-sms Yes
AfricasTalking https://build.at-labs.io/docs/sms%2Fsending Yes
BetaSms https://login.betasms.com.ng/ Yes
MultiTexter https://web.multitexter.com/MultiTexter_HTTP_SMS_API%202.0.pdf Yes
BulkSmsNigeria https://www.bulksmsnigeria.com/bulk-sms-api Yes
GoldSms247 https://goldsms247.com/index.php/api Yes
KudiSms https://kudisms.net/api/ Yes
Mebosms http://mebosms.com/api-sms Yes
NigerianBulkSms https://nigeriabulksms.com/sms-gateway-api/ Yes
SmartSmsSolutions https://docs.smartsmssolutions.com/docs/send-with-basic-route Yes
RingCaptcha https://my.ringcaptcha.com/docs/api No
SmsLive247 http://portal.smslive247.com/developer_api/http.aspx No
XWireless https://xwireless.net/cportal/knowledge-base/article/sms-3 No
InfoBip https://dev.infobip.com/send-sms/single-sms-message No

Note: For smartSmsSolutions, you have to whitelist the sender on the platform before using, else smartsms will automatically change your senderId when sending - #6

Creating custom SMS Provider

  • Create a class that extends Djunehor\Sms\Concrete\Sms class
  • Implement the send() which makes the request and return bool
  • (Optional) You can add the provider keys to the config/laravel-sms.php

Contributing

  • Fork this project
  • Clone your forked repo
  • Make your changes and run tests composer test
  • Push and create Pull Request
  • Make sure your PR passes all checks

djunehor/laravel-sms 适用场景与选型建议

djunehor/laravel-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.71k 次下载、GitHub Stars 达 39, 最近一次更新时间为 2019 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「sms」 「laravel」 「laravel-package」 「djunehor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 djunehor/laravel-sms 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 39
  • Watchers: 1
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-27