定制 octopush/sms-api 二次开发

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

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

octopush/sms-api

Composer 安装命令:

composer require octopush/sms-api

包简介

Octopush - Send SMS like a PRO

README 文档

README

Octopush SMS API PHP client.

Installation

$ composer require octopush/sms-api

Usage

Sending a text SMS Campaign

<?php

$client = new Octopush\Client('*****@mail.com', '***API-KEY***');

$request = new Octopush\Request\SmsCampaign\SendSmsCampaignRequest();
$request->setRecipients([
    [
        'phone_number' => '+33600000000',
        'param1' => 'Alex',
    ]
]);
$request->setSender('AnySender');
$request->setText('Hello {param1}, HAPPY NEW YEAR');
$request->setType(Octopush\Constant\TypeEnum::SMS_PREMIUM);

// ---------------------------------
// optional
// ---------------------------------
$request->setPurpose(Octopush\Request\SmsCampaign\SendSmsCampaignRequest::ALERT_TRANSACTIONAL);
$request->setWithReplies(false);

$date = new DateTimeImmutable('2021-01-01 00:01:00');
$isoDateWithTimeZone = $date->format(DATE_ISO8601); // 2021-01-01T00:01:00+0100
$request->setSendAt($isoDateWithTimeZone); // also works with "2021-01-01 00:01:00", (Central European TimeZone by default)
// ---------------------------------

$content = $client->send($request);

// ---------------------------------
// Result example:
// ---------------------------------
{
    "sms_ticket": "sms_5fec89fe97109",
    "number_of_contacts": 1,
    "total_cost": 0.0333,
    "number_of_sms_needed": 1,
    "residual_credit": 99.5
}

Sending a Vocal SMS Campaign

<?php

$client = new Octopush\Client('*****@mail.com', '***API-KEY***');

$request = new Octopush\Request\VocalCampaign\SendVocalCampaignRequest();
$request->setRecipients([
    [
        'phone_number' => '+33600000000',
    ]
]);
$request->setSender('AnySender');
$request->setText('Hello, HAPPY NEW YEAR');
$request->setType(Octopush\Constant\TypeEnum::VOCAL_SMS);
$request->setVoiceGender('female');
$request->setVoiceLanguage('fr-FR');

// ---------------------------------
// optional
// ---------------------------------
$request->setPurpose(Octopush\Request\VocalCampaign\SendVocalCampaignRequest::ALERT_TRANSACTIONAL);

$date = new DateTimeImmutable('2021-01-01 00:01:00');
$isoDateWithTimeZone = $date->format(DATE_ISO8601); // 2021-01-01T00:01:00+0100
$request->setSendAt($isoDateWithTimeZone); // also works with "2021-01-01 00:01:00", (Central European TimeZone by default)
// ---------------------------------

$content = $client->send($request);

// ---------------------------------
// Result example:
// ---------------------------------
{
    "vocal_ticket": "vocal_5fed928fda524",
    "number_of_contacts": 1,
    "total_cost": 0.03,
    "residual_credit": 99.5,
    "estimated_duration": 30
}

Checking your credit

<?php

$client = new Octopush\Client('*****@example.com', '***API-KEY***');

$request = new Octopush\Request\GetCreditRequest();
$request->setProductName(Octopush\Constant\TypeEnum::VOCAL_SMS);
$request->setCountryCode('FR');
$request->setWithDetails(true);

$content = $client->send($request);

// ---------------------------------
// Result example:
// ---------------------------------
{
    "amount": 10,
    "unit": "vocal_sms",
    "wallet_packs": [
        {
            "id": "1d234c18-396c-12eb-b80e-02455c12550a",
            "credit": 10,
            "expiration_date": "2030-12-08T16:45:14+01:00"
        }
    ]
}

cURL examples

You can find cURL examples in curl-examples directory.

octopush/sms-api 适用场景与选型建议

octopush/sms-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 99.23k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2016 年 02 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 3
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-29