mail-mantra/sms
Composer 安装命令:
composer require mail-mantra/sms
包简介
Send SMS
README 文档
README
A simple library to send SMS using MM Sms Service
Official PHP library for Mail Mantra SMS.
Read up here for getting started and understanding the sms flow with MM Sms: https://sms1.mailmantra.com/v2
Prerequisites
- A minimum of PHP 7.3 upto 8.3
Installation
- If your project using composer, run the below command
composer require mail-mantra/sms
- If you are not using composer, download the latest release from the releases section.
##Note: This PHP library follows the following practices:
- Namespaced under
MM\Sms - API throws exceptions instead of returning errors
- Options are passed as an array instead of multiple arguments wherever possible
- All requests and responses are communicated over JSON
Documentation
Documentation of MM SMS's API and their usage is available at https://sms1.mailmantra.com
Basic Usage
Instantiate the MM Sms instance with auth_key. You can obtain the keys from the dashboard app (https://sms1.mailmantra.com/v2/sender_id/list_all)
use MailMantra\Sms\Sms; $mmSMS = new Sms($auth_key);
The resources can be accessed via the $mmSMS object. All the methods invocations follows the following pattern
// $mmSMS->function() to access the API //Example $mmSMS->send('9876543210', '1234 is Your OTP. Do not share with anyone.','123456789101112');
Common Examples
View Balance:
To view your balance
use MilanSahana\MmSms\Sms; $mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG"); $balance_arr = $mmSMS->balance(); var_dump($balance_arr);
Output:
array(3) { ["status"]=> int(1) ["message"]=> string(1) "7" ["code"]=> string(6) "MMTEST" }
Send sms:
Send a sms to one or more mobile number(comma seperated mobile numbers)
use MilanSahana\MmSms\Sms; $mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG"); $send_report = $mmSMS->send('9876543210', '123456 is Your OTP. Do not share with anyone.','12345678901234567890'); var_dump($send_report);
Output:
array(3) { ["status"]=> int(1) ["message"]=> string(25) "1 SMS send Successfully.." ["code"]=> string(24) "346772774568353130393036" }
Send Bulk sms:
Send a sms to one or more mobile number(comma seperated mobile numbers)
use MilanSahana\MmSms\Sms; $mmSMS = new Sms("JFDG231HFDJ34KGH8438DSUG4FUD8SG"); $sms = [ [ 'message' =>'1234 Your OTP. Do not share with anyone.', 'to'=>[ '9999999999', '8888888888', ] ], [ 'message' =>'56789 Your OTP. Do not share with anyone.', 'to'=>[ '7777777777', '9876543210' ] ], ]; $send_bulk_report = $mmSMS->sendBulk($sms, '12345678901234567890'); var_dump($send_bulk_report);
Output:
array(3) { ["status"]=> int(1) ["message"]=> string(25) "4 SMS send Successfully.." ["code"]=> string(24) "346772774163393934343834" }
Changelog
Version 1.0.1 provided by milan-sahana - Testing
- Cleaned Up Code
- Fixed Bugs
- A minimum of PHP 7.3
- Added Option to prevent json error
Version 1.0.0 - Stable Release
- View Balance
- Added Send SMS in Bulk
- Fixed issue Send SMS
- Update extras array
- Updating version pattern.
x.y.z
x = Main version of the plugin
y = New features were added to the plugin
z = Fixes/patches to existing features of the plugin
License
The MM SMS PHP SDK is released under the MIT License. See LICENSE file for more details.
mail-mantra/sms 适用场景与选型建议
mail-mantra/sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mail-mantra/sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mail-mantra/sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-19