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

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

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

bsg/php-sdk-v1

Composer 安装命令:

composer require bsg/php-sdk-v1

包简介

Comprehensive API for sending SMS, Viber messages, HLR/MNP requests and service management

README 文档

README

Comprehensive API for sending SMS, Viber messages, HLR/MNP requests and service management

For more information, please visit https://bsg.world.

Installation

composer require bsgworld/php-sdk-v1

Requirements

  • PHP 7.4 or later
  • Guzzle HTTP client (installed automatically)

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');


$apiInstance = new BSG\Api\V1\Api\SMSMessagingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sms_price_check_request = new \BSG\Api\V1\Model\SmsPriceCheckRequest([
    'destination' => 'phone',
    'msisdn' => '380953227271',
    'originator' => 'BSG',
    'body' => 'Hello! This is a test message for price calculation.',
    'transliterate' => true,
]);
try {
    $result = $apiInstance->smsCheckPrice($sms_price_check_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SMSMessagingApi->smsCheckPrice: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
sms_price_check_request \BSG\Api\V1\Model\SmsPriceCheckRequest

Return type

\BSG\Api\V1\Model\SmsPriceCheckResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

smsCheckPricePut()

smsCheckPricePut($sms_price_check_request): \BSG\Api\V1\Model\SmsPriceCheckResponse

Check SMS price (PUT)

Calculate SMS price without sending using PUT method

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');


$apiInstance = new BSG\Api\V1\Api\SMSMessagingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sms_price_check_request = new \BSG\Api\V1\Model\SmsPriceCheckRequest([
    'destination' => 'phone',
    'msisdn' => '380953227271',
    'originator' => 'BSG',
    'body' => 'Hello! This is a test message for price calculation.',
    'transliterate' => true,
]);
try {
    $result = $apiInstance->smsCheckPricePut($sms_price_check_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SMSMessagingApi->smsCheckPricePut: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
sms_price_check_request \BSG\Api\V1\Model\SmsPriceCheckRequest

Return type

\BSG\Api\V1\Model\SmsPriceCheckResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

smsCreateObjects()

smsCreateObjects($sms_create_request): \BSG\Api\V1\Model\SmsCreateResponse

Send SMS message

Send SMS message to one or multiple recipients

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BSG\Api\V1\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');


$apiInstance = new BSG\Api\V1\Api\SMSMessagingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sms_create_request = new \BSG\Api\V1\Model\SmsCreateRequest([
    'destination' => 'phone',
    'msisdn' => '380953227271',
    'originator' => 'testsms',
    'body' => 'k TEST Hello12 SMS 1115222',
    'reference' => '1737033400123',
    'validity' => 72,
    'callback_url' => 'https://webhook.site/wh-delivery-reports',
    '2way' => 0,
    'transliterate' => false,
]);
try {
    $result = $apiInstance->smsCreateObjects($sms_create_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SMSMessagingApi->smsCreateObjects: ', $e->getMessage(), PHP_EOL;
}

Endpoints

All URIs are relative to https://api.sms-service.local

Class Method HTTP request Description
AccountManagementApi commonGetBalance GET /rest/common/balance Get account balance
AccountManagementApi commonGetBalancePost POST /rest/common/balance Get account balance (POST)
CommonBalanceApi commonGetBalance GET /rest/common/balance Get account balance
CommonBalancePostApi commonGetBalancePost POST /rest/common/balance Get account balance (POST)
HLRNumberVerificationApi hlrCreateObjects POST /rest/hlr/create Perform HLR lookup
HLRNumberVerificationApi hlrCreateObjectsPut PUT /rest/hlr/create Perform HLR lookup (PUT)
HLRNumberVerificationApi hlrCreateObjectsSync POST /rest/hlr/check Perform synchronous HLR lookup
HLRNumberVerificationApi hlrCreateObjectsSyncPut PUT /rest/hlr/check Perform synchronous HLR lookup (PUT)
HLRNumberVerificationApi hlrGetBalance GET /rest/hlr/balance Get account balance
HLRNumberVerificationApi hlrGetBalancePost POST /rest/hlr/balance Get account balance
HLRNumberVerificationApi hlrGetPrices GET /rest/hlr/prices Get HLR pricing
HLRNumberVerificationApi hlrGetStatusByExtId GET /rest/hlr/reference/{reference} Get HLR result by reference
HLRNumberVerificationApi hlrGetStatusById GET /rest/hlr/{id} Get HLR result by ID
HlrBalanceApi hlrGetBalance GET /rest/hlr/balance Get account balance
HlrBalancePostApi hlrGetBalancePost POST /rest/hlr/balance Get account balance
HlrCreateApi hlrCreateObjects POST /rest/hlr/create Perform HLR lookup
HlrCreatePutApi hlrCreateObjectsPut PUT /rest/hlr/create Perform HLR lookup (PUT)
HlrCreateSyncApi hlrCreateObjectsSync POST /rest/hlr/check Perform synchronous HLR lookup
HlrCreateSyncPutApi hlrCreateObjectsSyncPut PUT /rest/hlr/check Perform synchronous HLR lookup (PUT)
HlrPricesApi hlrGetPrices GET /rest/hlr/prices Get HLR pricing
HlrStatusByIdApi hlrGetStatusById GET /rest/hlr/{id} Get HLR result by ID
HlrStatusByRefApi hlrGetStatusByExtId GET /rest/hlr/reference/{reference} Get HLR result by reference
MNPPortabilityApi mnpCreateObjects POST /rest/mnp/create Perform MNP lookup
MNPPortabilityApi mnpCreateObjectsPut PUT /rest/mnp/create Perform MNP lookup (PUT)
MNPPortabilityApi mnpGetPrices GET /rest/mnp/prices Get MNP pricing
MNPPortabilityApi mnpGetStatusByExtId GET /rest/mnp/reference/{reference} Get MNP result by reference
MNPPortabilityApi mnpGetStatusById GET /rest/mnp/{id} Get MNP result by ID
MNPSyncApi mnpSyncCreateObjects POST /rest/mnp-sync/create Perform synchronous MNP lookup
MNPSyncApi mnpSyncCreateObjectsPut PUT /rest/mnp-sync/create Perform synchronous MNP lookup (PUT)
MNPSyncApi mnpSyncGetPrices GET /rest/mnp-sync/prices Get MNP pricing
MnpCreateApi mnpCreateObjects POST /rest/mnp/create Perform MNP lookup
MnpCreatePutApi mnpCreateObjectsPut PUT /rest/mnp/create Perform MNP lookup (PUT)
MnpPricesApi mnpGetPrices GET /rest/mnp/prices Get MNP pricing
MnpStatusByIdApi mnpGetStatusById GET /rest/mnp/{id} Get MNP result by ID
MnpStatusByRefApi mnpGetStatusByExtId GET /rest/mnp/reference/{reference} Get MNP result by reference
MnpSyncCreateApi mnpSyncCreateObjects POST /rest/mnp-sync/create Perform synchronous MNP lookup
MnpSyncCreatePutApi mnpSyncCreateObjectsPut PUT /rest/mnp-sync/create Perform synchronous MNP lookup (PUT)
MnpSyncPricesApi mnpSyncGetPrices GET /rest/mnp-sync/prices Get MNP pricing
SMSMessagingApi smsCheckPrice POST /rest/sms/price Check SMS price
SMSMessagingApi smsCheckPricePut PUT /rest/sms/price Check SMS price (PUT)
SMSMessagingApi smsCreateObjects POST /rest/sms/create Send SMS message
SMSMessagingApi smsCreateObjectsPut PUT /rest/sms/create Send SMS message (PUT)
SMSMessagingApi smsGet2WayIncoming GET /rest/sms/2wayIncoming Get 2-way incoming messages
SMSMessagingApi smsGet2WaySenders GET /rest/sms/2waySenders Get 2-way senders
SMSMessagingApi smsGetBalance GET /rest/sms/balance Get account balance
SMSMessagingApi smsGetBalancePost POST /rest/sms/balance Get account balance
SMSMessagingApi smsGetMassStatus POST /rest/sms/getStatus Get status for multiple SMS messages
SMSMessagingApi smsGetPrices GET /rest/sms/prices Get SMS pricing
SMSMessagingApi smsGetStatusByExtId GET /rest/sms/reference/{reference} Get SMS status by reference
SMSMessagingApi smsGetStatusById GET /rest/sms/{id} Get SMS status by ID
SMSMessagingApi smsGetTaskStatus GET /rest/sms/task/{taskId} Get task status
Sms2wayIncomingApi smsGet2WayIncoming GET /rest/sms/2wayIncoming Get 2-way incoming messages
Sms2waySendersApi smsGet2WaySenders GET /rest/sms/2waySenders Get 2-way senders
SmsBalanceApi smsGetBalance GET /rest/sms/balance Get account balance
SmsBalancePostApi smsGetBalancePost POST /rest/sms/balance Get account balance
SmsCheckPriceApi smsCheckPrice POST /rest/sms/price Check SMS price
SmsCheckPricePutApi smsCheckPricePut PUT /rest/sms/price Check SMS price (PUT)
SmsCreateApi smsCreateObjects POST /rest/sms/create Send SMS message
SmsCreatePutApi smsCreateObjectsPut PUT /rest/sms/create Send SMS message (PUT)
SmsMassStatusApi smsGetMassStatus POST /rest/sms/getStatus Get status for multiple SMS messages
SmsPricesApi smsGetPrices GET /rest/sms/prices Get SMS pricing
SmsStatusByIdApi smsGetStatusById GET /rest/sms/{id} Get SMS status by ID
SmsStatusByRefApi smsGetStatusByExtId GET /rest/sms/reference/{reference} Get SMS status by reference
SmsTaskStatusApi smsGetTaskStatus GET /rest/sms/task/{taskId} Get task status
StatDeleteFileApi statDeleteFile DELETE /rest/stat/file/{id} Delete export file
StatGetFileApi statGetFile GET /rest/stat/file/id/{id}/format/{format} Download export file
StatListExportsApi statGetList GET /rest/stat/list List export jobs
StatRequestExportApi statRequestExport POST /rest/stat/create Request data export
StatRequestExportPutApi statRequestExportPut PUT /rest/stat/create Request data export (PUT)
StatisticsExportsApi statDeleteFile DELETE /rest/stat/file/{id} Delete export file
StatisticsExportsApi statGetFile GET /rest/stat/file/id/{id}/format/{format} Download export file
StatisticsExportsApi statGetList GET /rest/stat/list List export jobs
StatisticsExportsApi statRequestExport POST /rest/stat/create Request data export
StatisticsExportsApi statRequestExportPut PUT /rest/stat/create Request data export (PUT)
ViberCheckPriceApi viberCheckPrice POST /rest/viber/price Check Viber campaign price
ViberCheckPricePutApi viberCheckPricePut PUT /rest/viber/price Check Viber campaign price (PUT)
ViberCreateApi viberCreateObjects POST /rest/viber/create Send Viber message
ViberCreatePutApi viberCreateObjectsPut PUT /rest/viber/create Send Viber message (PUT)
ViberMessagingApi viberCheckPrice POST /rest/viber/price Check Viber campaign price
ViberMessagingApi viberCheckPricePut PUT /rest/viber/price Check Viber campaign price (PUT)
ViberMessagingApi viberCreateObjects POST /rest/viber/create Send Viber message
ViberMessagingApi viberCreateObjectsPut PUT /rest/viber/create Send Viber message (PUT)
ViberMessagingApi viberGetPrices GET /rest/viber/prices/{tariff} Get Viber pricing
ViberMessagingApi viberGetStatusByExtId GET /rest/viber/reference/{reference} Get Viber status by reference
ViberMessagingApi viberGetStatusById GET /rest/viber/{id} Get Viber status by ID
ViberPricesApi viberGetPrices GET /rest/viber/prices/{tariff} Get Viber pricing
ViberStatusByIdApi viberGetStatusById GET /rest/viber/{id} Get Viber status by ID
ViberStatusByRefApi viberGetStatusByExtId GET /rest/viber/reference/{reference} Get Viber status by reference

Models

Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

support@bsg.world

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
    • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

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

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

它主要适用于以下技术方向: 「php」 「rest」 「api」 「sdk」 「openapi」 「openapitools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-22