定制 yiiman/mediana-sms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固