franckysolo/octopush-sdk 问题修复 & 功能扩展

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

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

franckysolo/octopush-sdk

Composer 安装命令:

composer require franckysolo/octopush-sdk

包简介

Php SDK for octopush API SMS

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock available

Php SDK for Octopush API SMS

Installation

composer require franckysolo/octopush-sdk

tests

Create a env.php file in tests/config

<?php

define('OCTOPUSH_API_KEY', 'your-key');
define('OCTOPUSH_LOGIN', 'your-login');
define('TEST_PHONE_NUMBER', 'your-phone-number');

?>

To run tests

composer test

Usages

Config

Create a app.php file in configs directory

<?php

define('OCTOPUSH_API_KEY', 'your-key');
define('OCTOPUSH_LOGIN', 'your-login');
define('TEST_PHONE_NUMBER', '0033601010101'); // for fr format
define('TEST_PHONE_NUMBER_ALT', '0033601010102');

?>

Get Credit

<?php

require_once '../vendor/autoload.php';
require_once '../configs/app.php';

use Octopush\Api;

$api = new Api(OCTOPUSH_LOGIN, OCTOPUSH_API_KEY);
$credit = $api->getCredit();
?>
<pre>
Remaining Credit :  <?php echo $credit;?> &euro;
</pre>

Get Balance

<?php
require_once '../vendor/autoload.php';
require_once '../configs/app.php';

use Octopush\Api;

$api = new Api(OCTOPUSH_LOGIN, OCTOPUSH_API_KEY);
$balance = $api->getBalance();
$premium = $api->getPremiumBalance();
$low = $api->getLowCostBalance();
?>
<pre>
  <?php var_dump(balance);?>

  Remaining Sms Low cost :  <?php echo $low;?>

  Remaining Sms Premium :  <?php echo $premium;?>
</pre>

Send a simple message

<?php
require_once '../vendor/autoload.php';
require_once '../configs/app.php';

use Octopush\Api;

$api = new Api(OCTOPUSH_LOGIN, OCTOPUSH_API_KEY);
$message = 'this is a simple sms message';
$api->sendMessage($message, [
  'sms_recipients' => TEST_PHONE_NUMBER,
  'sms_text' => $message,
  'sms_type' => Message::SMS_PREMIUM,
  'sms_sender' => 'Octopush sdk'
]);
?>
<pre>
<?php echo var_dump($api->getClient()->getResponse());?>
</pre>

Send a publipostage message

<?php
require_once '../vendor/autoload.php';
require_once '../configs/app.php';

use Octopush\Api;

$api = new Api(OCTOPUSH_LOGIN, OCTOPUSH_API_KEY);
$message = 'Hello {ch1} {nom} {prenom}, your session begin at {ch2} the {ch3}';

$api->sendMessage($message, [
  'sms_recipients' => [TEST_PHONE_NUMBER, TEST_PHONE_NUMBER_ALT],
  'sms_text' => $message,
  'sms_type' => Message::SMS_PREMIUM,
  'sms_sender' => 'Octopush sdk',
  'request_mode' => Message::SIMULATION_MODE,
  'recipients_first_names' => ['John', 'Jane'],
  'recipients_last_names' => ['John', 'Jane'],
  'sms_fields_1' => ['Mr', 'Miss'],
  'sms_fields_2' => ['08:00 am', '01:00 pm'],
  'sms_fields_3' => ['2018/05/21', '2018/05/22'],
]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固