textko/php

该软件包最新版本(3.0.0)的许可信息不可用。

Textko.com 的官方 PHP 库

3.0.0 2019-11-27 12:24 UTC

README

这是 Textko.com API 的官方 PHP 库。

安装

您可以通过 composer 安装我们的库。

composer require textko/php

更多信息,请参阅:Packagist

获取您的 API 访问令牌

要开始使用此库,您首先需要一个 API 访问令牌。

注册以获取您的访问令牌

快速使用

发送短信

示例

<?php require_once 'vendor/autoload.php';

$textko = new Textko\Sms('your-access-token-here');

$sms = $textko->send('09171234567', 'My awesome text message');

$sms->smsId(); // Get sms id.
$sms->toNo(); // Get recipient to no.
$sms->text(); // Get sms text.
$sms->status(); // Get sms current status.

获取短信列表

要获取您的短信列表,请使用 getList() 函数。

示例

<?php require_once 'vendor/autoload.php';

$textko = new Textko\Sms('your-access-token-here');

$list = $textko->getList();

$list->data(); // Get list of sms.

获取一条消息

要获取特定的短信,请使用 get($smsId) 函数。短信 ID 是必需的。

示例

<?php require_once 'vendor/autoload.php';

$textko = new Textko\Sms('your-access-token-here');

$smsId = 'ABC';
$sms = $textko->get($smsId);

$sms->smsId(); // Get sms id.
$sms->toNo(); // Get recipient to no.
$sms->text(); // Get sms text.
$sms->status(); // Get sms current status.

响应和错误

通常,所有 API 响应都以 SmsResponseContract 的形式呈现。如果出现问题,它将抛出 SmsException

REST API 文档

了解我们的 REST API 文档的更多信息。

查看:API 文档

需要帮助?

请随时联系我们。我们很乐意提供帮助。

电子邮件: hello@textko.com

Facebook: /textko

Twitter: @textko

聊天: 查看我们的网站