thesmsworks/smsw-php-sdk

The SMS Works 为开发者提供低成本的可靠 SMS API。仅对已发送的短信付费,所有失败的英国短信都将退款。

dev-master 2024-05-20 13:51 UTC

This package is auto-updated.

Last update: 2024-09-20 14:25:25 UTC


README

The SMS Works 为开发者提供低成本的可靠 SMS API。仅对已发送的短信付费,所有失败的英国短信都将退款。

更多信息,请访问 https://thesmsworks.co.uk/contact.

安装 & 使用

要求

PHP 7.4 及更高版本。也应适用于 PHP 8.0。

Composer

要使用 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/thesmsworks/smsw-php-sdk.git"
    }
  ],
  "require": {
    "thesmsworks/smsw-php-sdk": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门指南

请按照 安装过程 进行操作,然后运行以下命令

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



// Configure API key authorization: JWT
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new OpenAPI\Client\Api\BatchMessagesApi(
    // 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
);
$messages = array('key' => new \stdClass); // object | An array of messages

try {
    $result = $apiInstance->batchAnyPost($messages);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BatchMessagesApi->batchAnyPost: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都是相对于 https://api.thesmsworks.co.uk/v1

模型

授权

API 定义的认证方案

JWT

  • 类型: API 密钥
  • API 密钥参数名称: 授权
  • 位置: HTTP 标头

测试

要运行测试,使用

composer install
vendor/bin/phpunit

作者

support@thesmsworks.co.uk

关于此包

此 PHP 包是由 OpenAPI Generator 项目自动生成的

  • API 版本: 1.9.0
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen