codehub/sms-api
Composer 安装命令:
composer require codehub/sms-api
包简介
A Library for PHP SMS API (Semaphore)
关键字:
README 文档
README
SMS API is a Third Party PHP Library for Short Message Service API
Table of Contents
Installation
composer require codehub/sms-api
Semaphore
Initialization
<?php require_once('vendor/autoload.php'); use CodeHub\SMS\Semaphore; $semaphore = new Semaphore('{API_KEY}', '{SENDER_NAME}'); // Optional SENDER_NAME default to Semaphore
Sending Messages
echo $semaphore->send('09123456789', 'Your message here');
Response:
[
{
"message_id": 1234567,
"user_id": 12345,
"user": "user@example.com",
"account_id": 54321,
"account": "Your Account Name",
"recipient": "09123456789",
"message": "The message you sent",
"sender_name": "SEMAPHORE",
"network": "Globe",
"status": "Sent",
"type": "Single",
"source": "Api",
"created_at": "0000-00-00 00:00:00",
"updated_at": "0000-00-00 00:00:00"
}
]
Sending Bulk Messages
You can specify up to 1,000 recipients/numbers at a time.
echo $semaphore->send(['09123456789', '09987654321'], 'Your message here');
Sending Priority Messages
Normally messages are processed in the order they are received and during periods of heavy traffic messaging, messages can be delayed. If your message is time sensitive, you may wish to use our premium priority queue which bypasses the default message queue and sends the message immediately. This service is 2 credits per 160 character SMS.
echo $semaphore->priority('09123456789', 'Your message here');
Retrieving Messages
You can retrieve up to 100 sent messages at a time, with support for pagination by passing the optional $page variable:
echo $semaphore->messages(['limit' => 100, 'page' => 3]);
Filter by date range:
echo $semaphore->messages(['startDate' => '0000-00-00', 'endDate' => '0000-00-00']);
Filter by telco network e.g. "globe", "smart":
echo $semaphore->messages(['network' => 'globe']);
Filter by status e.g. "pending", "success":
echo $semaphore->messages(['status' => 'success']);
Retrieving Your Account
echo $semaphore->account();
Response:
{
"account_id": 12345,
"account_name": "Your Organization",
"status": "Active",
"credit_balance": 1000
}
Retrieving Your Transactions
echo $semaphore->transactions();
Retrieving Your SenderNames
echo $semaphore->sendernames();
Response:
[
{
"name":"Semaphore",
"status":"Active",
"created":"0000-00-00 00:00:00"
},
{
"name":"Example",
"status":"Active",
"created":"0000-00-00 00:00:00"
}
]
Retrieving Your Users
echo $semaphore->users();
Response:
[
{
"user_id": 12345,
"email": "owner@example.com",
"role": "Owner"
},
{
"user_id": 54321,
"email": "user@example.com",
"role": "User"
}
]
codehub/sms-api 适用场景与选型建议
codehub/sms-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 207 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「semaphore」 「sms-api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codehub/sms-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codehub/sms-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codehub/sms-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for Mutex implementation for PHP
This library provides an api for semaphore acquire and release
Symfony Lock Component
This is a Symfony2 bundle that provides a semaphore system.
Send SMS messages through the LabsMobile platform and the PHP library.
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
统计信息
- 总下载量: 207
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-01