netsplit/textlocal

通用的Textlocal SMS库

1.1.1 2018-07-05 11:26 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:27:51 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

安装

通过Composer

$ composer require netsplit/textlocal

使用方法

$textlocal = new Netsplit\Textlocal(
    'https://path.to.textlocal.com/api2',
    'api-key-here'
);

发送短信

"send"端点的API文档.

$response = $textlocal->sendSMS('Message content', [
    // Array of mobile numbers
    '07777777777',
    '07777777778',
], [
    // Optional values
    'containsTrackingLinks' => false,                  // Should URLs in the SMS be minified?
    'custom'                => 'Any string',           // For use as a reference
    'groupID'               => 5,                      // A Textlocal group ID
    'receiptURL'            => 'http://[...]',         // Custom receipt URL
    'scheduleAt'            => 1530735900,             // Unix timestamp - send the SMS at this time
    'sender'                => 'Optional Sender Name',
    'sendToOptOut'          => false,                  // Should the SMS be sent to users who have opted out?
    'simpleReply'           => false,                  // Disregard sender
    'test'                  => true,                   // Don't really send the SMS
    'unicode'               => false,                  // Does the SMS contain unicode characters?
    'validUntil'            => 1530735994,             // Unix timestamp - disregard the SMS at this time
]);

// Access values from the response:
echo $response->getStatus()->__toString(); // Hopefully "success"!
echo $response->getBalance()->getValue();

缩短URL

"short URL"端点的API文档

$response = $textlocal->getShortURL('https://www.google.com');
$shortURL = $response->getShortURL()->__toString();

变更日志

请参阅CHANGELOG以获取最近更改的详细信息。

测试

$ composer test

贡献

请参阅CONTRIBUTING以获取详细信息。

安全

如果您发现任何安全相关的问题,请通过电子邮件[已隐藏]联系,而不是使用问题跟踪器。

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。