yiiman/mediana-sms
Composer 安装命令:
composer require yiiman/mediana-sms
包简介
Classified Mediana(IPPanel) sms API, created by APIStorm package
README 文档
README
MedianaSMS API - created by APIStorm package
This package is fully classified responses and send data In this package you can validate data before send to server with internal validation method,then this package is safe for programmers that want to know different between server errors and posted data errors or etc
Install
You can install this package easily by composer
Just type this code on command line:
composer require yiiman/mediana-sms
Usage
Usage of this package is easy and safe.
Let's start together:
In this example we want to know credit:
$api = new Yiiman\MedianaSms\MedianaSMS(); $api->apiKey = 'Your SMS panel API key'; $creditResult = $api->getCredit(); if ($creditResult->isSuccess()) { echo $creditResult->credit;//is Float }else{ echo "Response has some errors:\n\n"; var_dump($creditResult->getError()->message); }
In this example we want to validate our data and then send new SMS:
$api = new Yiiman\MedianaSms\MedianaSMS(); $api->apiKey = 'Your SMS panel API key'; // < Initializing data > { $dataSms = new SendSMSRequest(); $dataSms->originator0 = $sms_line; $dataSms->recipients0 = [$test_mobile_number]; $dataSms->message0 = 'this is test'; } // </ Initializing data > if ($dataSms->validate()) { $sendResult = $api->send($dataSms); if ($sendResult && $sendResult->bulk_id) { $message_info = $api->getMessage($sendResult->bulk_id); if ($message_info->isSuccess()) { echo "Message info :\n\n"; echo '-- message:'.$message_info->message."\n"; echo '-- status:'.$message_info->status."\n"; echo '-- created at:'.$message_info->created_at."\n"; echo '-- type:'.$message_info->type."\n"; echo '-- confirm status:'.$message_info->confirm_state."\n"; echo '-- number:'.$message_info->number."\n"; echo '-- sent at:'.$message_info->sent_at."\n"; echo '-- cost:'.$message_info->cost."\n"; echo '-- payback cost:'.$message_info->payback_cost."\n"; echo '-- count of receivers:'.$message_info->recipients_count."\n"; echo '-- count of valid receivers:'.$message_info->valid_recipients_count."\n"; } else { echo "Server returned some errors:\n\n"; var_dump($message_info->getError()->message); } } } else { echo "Your posted data has some errors:\n\n"; var_dump($dataSms->errors()); }
Sample codes
You can find samples in test.php file
For run test.php file ,you should change env-example.php to env.php and fill data in that
When env.php file is ready, open terminal and type:
php test.php
API Documents
Credits
- Programmed by YiiMan
- Sponsored by AriaService
- Powered by APIStorm
yiiman/mediana-sms 适用场景与选型建议
yiiman/mediana-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 130 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 yiiman/mediana-sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yiiman/mediana-sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 130
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-04-03