承接 onesend-gmbh/onesend-php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

onesend-gmbh/onesend-php-sdk

最新稳定版本:1.0.2

Composer 安装命令:

composer require onesend-gmbh/onesend-php-sdk

包简介

PHP SDK for OneSend messaging service

README 文档

README

Requirements

To use the OneSend PHP SDK the following things are required:

Installation

Using Composer

The best way to install the OneSend PHP SDK is by using Composer. You can require it with the following command:

composer require onesend-gmbh/onesend-php-sdk

Usage

Initialise the SDK by passing the Api Key from your Project Dashboard.

$oneSend = new \OnesendGmbh\OnesendPhpSdk\OneSendApi('YOUR KEY HERE');

Optionally you can also pass a PSR-18 compliant Client as second argument if you want to modify timeouts/retry behavior or for Testing.

Using the SDK you can now access the following endpoints:

API Resource Code Link to Endpoint File
Short Messages API Short Messages $oneSend->shortMessages ShortMessageEndpoint

You can find our full documentation here.

Short Messages

Sending Short Messages (SMS)

Create Short Message reference

$shortMessage = $oneSend->shortMessages->send([
    'to' => '+4915730955123',
    'from' => 'TEST',
    'message' => 'THIS IS A TEST',
]);

This will create a ShortMessage Resource with a message ID $shortMessage->getId() you can and some other information about the sent short message.

Testing

By default, the SDK will set the Symfony Http Client as HTTP Client on initialisation, meaning should you not Mock calls to the SDK, it WILL send request to our service and your tests will most likely fail.
If you don't want to (or can't) mock the calls to the SDK you can also replace the HTTP Client with a Mock Client (PHP HTTP Mock Client for example) by passing it as the second constructor argument:

$mockClient = new Http\Mock\Client();
$oneSend = new \OnesendGmbh\OnesendPhpSdk\OneSendApi('I am a Test', $mockClient);

This will replace the default Http Client and will enable you to intercept and validate requests made by the SDK as well as mock responses with the desired outcome.
To see the expected responses please consult our API docs.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-18