smsgateway24/smsgateway24-php-sdk 问题修复 & 功能扩展

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

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

smsgateway24/smsgateway24-php-sdk

Composer 安装命令:

composer require smsgateway24/smsgateway24-php-sdk

包简介

php sdk for smsgateway24.com

README 文档

README

SmsGateWay24 is a service that can turn you android phone to gateway and you can start sending messages throw it.

PHP SDK

PHP library for SmsGateWay24 API interaction.

Requires:

  • PHP 7.1+

Here's a demo of how you can use it:

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$to = "+4915752982212";  //required. Target Phone number
$message = "Hello, how are you?"; // required. Body Message. 
$deviceId = 10403; //required.  get it in your profile after app installation on your android
$sim=0;  // Optional. 0 or 1. For Dual SIM devices. (if you skip it -> default sim is  0)
$timeToSend = "2022-01-12 00:00:00"; // Optional. time when you want to send SMS
$customerid = 12; // Optional. your internal customer ID.
$urgent = 1; // Optional. 1 or 0 to make sms Urgent.
$smsId = $gateway->addSms($to, $message, $deviceId, $timeToSend, $sim, $customerid, $urgent);

After that, the phone with the Smsgateway24 application calls the server and takes the SMS and sends it from your sim card.

Getting Started

Visit our website, sign up and install app on your phone. Get your API token and device id.

Install the package via composer:

composer require smsgateway24/smsgateway24-php-sdk

API Methods

Add SMS to queue

Creates SMS on the server to send.

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$to = "+4915752982212";  //required. Target Phone number
$message = "Hello, how are you?"; // required. Body Message. 
$deviceId = 10403; //required.  get it in your profile after app installation on your android
$sim=0;  // Optional. 0 or 1. For Dual SIM devices. (if you skip it -> default sim is  0)
$timeToSend = "2022-01-12 00:00:00"; // Optional. time when you want to send SMS
$customerid = 12; // Optional. your internal customer ID.
$urgent = 1; // Optional. 1 or 0 to make sms Urgent.
$smsId = $gateway->addSms($to, $message, $deviceId, $timeToSend, $sim, $customerid, $urgent);


echo $smsId; 

Get SMS status

You can find out the status of each SMS using this method

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$smsId = 12345;

$statusResult = $gateway->getSmsStatus($smsId);

print_r($statusResult);
/*
Statuses values: 
1 - New (just created)
2 - Taken from Server. The phone picked up the SMS from the server, but there is no information about the delivery yet. 
5 - Income. 
6 - Sent by Phone. Good status. The phone sent a text message. But there is no information about the delivery yet. 
7 - Delivered. Good status. The phone texted and it was 100% delivered by the operator. The delivery status was sent to the server. (You need a webhook to your server - we have one! Write your server in the device settings on the website)
8 - Sms Not Delivered. The text message was not delivered. This usually means that the SIM card is blocked or the balance is negative
9 - Not SENT - Generic failure. The text message was not delivered. This usually means that the SIM card is blocked or the balance is negative
10 - Not sent - No service. 
11 - Not Sent - Null PD.
12 - Not Sent - Radio off.
100 - not sent - NOT ALLOWED. Click the permission button in the app
101 - not sent - Not Allowed At all. Click the permission button in the app
*/

Get device status

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$deviceId = 12345; // get it in your profile

$statusResult = $gateway->getDeviceStatus($deviceId);

print_r($statusResult);

Add Tag

Add contacts for any tag. For example, for the tag * Employees * your colleagues will perfectly fit.

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$tagId = $gateway->saveTag("Rich customers");

echo $tagId;

Save Contact

Add contacts for any tag. For example, for the tag * Employees * your colleagues will perfectly fit.

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$contactName = 'Support SmsGateWay24';
$phoneNum = '+4915752982212';
$tagId = 2456;

$contactId = $gateway->saveContact($contactName, $phoneNum, $tagId);

echo $contactId;

Create a Newsletter

Once you have created the tag, you can do the mailing on the tag phones.

use \SmsGateway24\SmsGateway24;

$gateway = new SmsGateway24('your-api-token-here'); // get it in your profile

$paketTitle = 'some title';
$deviceId = 1234; // get it in your profile
$body = 'body text';
$tags = [12, 13, 14]; // ids

$paketId = $gateway->savePaket($paketTitle, $deviceId, $body, $tags);

echo $paketId;

Contributing

Contributions are welcome!

Credits

smsgateway24/smsgateway24-php-sdk 适用场景与选型建议

smsgateway24/smsgateway24-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.54k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 smsgateway24/smsgateway24-php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-29