prihod/alphasms-client
Composer 安装命令:
composer require prihod/alphasms-client
包简介
PHP client for alphasms.ua API
关键字:
README 文档
README
This is client library for the alphasms.ua API.
1. Prerequisites
- PHP 7.4 or later
2. Installation
The alphasms-client can be installed using Composer by running the following command:
composer require prihod/alphasms-client
3. Initialization
Create Client object using the following code:
<?php use AlphaSMS\Client; require_once __DIR__ . '/vendor/autoload.php'; $apiKey = '7d514e5b-81e9-40fb-8a9e-7105ffddd3ed'; $client = new Client($apiKey);
4. API Requests
4.1. Request get balance
use AlphaSMS\Request\BalanceRequest; use AlphaSMS\Exception\RequestException; try { $request = new BalanceRequest(); $response = $client->execute($request); if ($response->isSuccess()) { echo "Response to array:\n"; print_r($response->toArray()); echo "Response get data:\n"; print_r($response->getData()); echo "Response get all entries:\n"; print_r($response->getEntries()); echo "Response get first entry:\n"; $entry = $response->getFirstEntry(); print_r($entry); if ($entry->isSuccess()) { echo "Entry to array:\n"; print_r($entry->toArray()); echo "Entry get data:\n"; print_r($entry->getData()); } else { echo "Entry Error: {$entry->getError()}"; } } else { echo "Response Error: {$response->getError()}"; } } catch (RequestException $e) { echo "Exception: {$e->getMessage()}\n"; print_r($e->request->toArray()); }
4.2. Request to send SMS
use AlphaSMS\Request\SMSRequest; $request = (new SMSRequest()) ->setPhone('380971234567') ->setSender('SMSTest') ->setMessage('Message text to be sent via SMS'); $response = $client->execute($request); ...
4.3. Multiple SMS sending request
use AlphaSMS\Request\SMSRequest; $requests = []; $requests[] = (new SMSRequest()) ->setPhone('380971234567') ->setSender('SMSTest') ->setMessage('Message text to be sent via SMS 1'); $requests[] = (new SMSRequest()) ->setPhone('380971234568') ->setSender('SMSTest') ->setMessage('Message text to be sent via SMS 2'); $requests[] = (new SMSRequest()) ->setPhone('380971234569') ->setSender('SMSTest') ->setMessage('Message text to be sent via SMS 3'); $response = $client->execute($requests); ...
4.4. Request to send a message to Viber
4.4.1. Text message
use AlphaSMS\Request\ViberRequest; $request = (new ViberRequest()) ->setType(ViberRequest::TYPE_TEXT) ->setPhone('380971234567') ->setSender("ViberTest") ->setMessage("Message text to send via Viber"); $response = $client->execute($request); ...
4.4.2. Image
use AlphaSMS\Request\ViberRequest; $request = (new ViberRequest()) ->setType(ViberRequest::TYPE_IMAGE) ->setPhone('380971234567') ->setSender("ViberTest") ->setImage('https://...... /storage/images/json.png'); $response = $client->execute($request); ...
4.4.3. Text with link
use AlphaSMS\Request\ViberRequest; $request = (new ViberRequest()) ->setType(ViberRequest::TYPE_TEXT_LINK) ->setPhone('380971234567') ->setSender("ViberTest") ->setMessage("Message text to send via Viber") ->setLink('https://alphasms.ua') ->setButtonText('Test'); $response = $client->execute($request); ...
4.4.4. Text with link and image
use AlphaSMS\Request\ViberRequest; $request = (new ViberRequest()) ->setType(ViberRequest::TYPE_TEXT_IMAGE_LINK) ->setPhone('380971234567') ->setSender("ViberTest") ->setMessage("Message text to send via Viber") ->setLink('https://alphasms.ua') ->setButtonText('Test') ->setImage('"https://...... /storage/images/json.png'); $response = $client->execute($request); ...
4.5. Request to send RCS
use AlphaSMS\Request\RCSRequest; $request = (new RCSRequest()) ->setPhone('380971234567') ->setSender('RCSTest') ->setMessage('Message text to be sent via RCS') ->setImage('https://alphasms.ua/storage/images/json.png') ->setLink('https://alphasms.ua') ->setButtonText('Test'); $response = $client->execute($request); ...
4.6. Request voice OTP
use AlphaSMS\Request\VoiceOTPRequest; $request = (new VoiceOTPRequest()) ->setPhone('380971234567'); $response = $client->execute($request); ...
4.7. Request HLR
use AlphaSMS\Request\HLRRequest; $request = (new HLRRequest()) ->setPhone('380971234567'); $response = $client->execute($request); ...
4.8. Request status message
use AlphaSMS\Request\StatusMessageRequest; $request = (new StatusMessageRequest()) ->setMessageId(12332); $response = $client->execute($request); ...
5. Links
- API docs
prihod/alphasms-client 适用场景与选型建议
prihod/alphasms-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「API-Client」 「alphasms.ua」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 prihod/alphasms-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 prihod/alphasms-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 prihod/alphasms-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Skolkovo API Client
A PSR-7 compatible library for making CRUD API endpoints
A client library for the OpenPLZ API project
Alfabank REST API integration
chargebee-php-sdk integration for WordPress
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-23