krisciunaskarolis/smsbiuras
最新稳定版本:1.0.0
Composer 安装命令:
composer require krisciunaskarolis/smsbiuras
包简介
PHP client for Smsbiuras.lt API
README 文档
README
PHP client for SmsBiuras sms sending API.
Client allows sending sms messages.
Getting Started
Installation
composer require krisciunaskarolis/smsbiuras
Authentication
You have to create SmsBiuras account first. More information here. After registration you have to create APIKEY, which will be used for authentication.
Sending messages
To send messages:
$apiKey = '[API_KEY]'; //replace [API_KEY] with your API key $userId = '[USER_ID]'; //replace [USER_ID] with your user id $smsSender = new \Krisciunas\SmsBiuras\Sender\SmsSender(); $message = new \Krisciunas\SmsBiuras\Message\SmsMessage( //Sender name (sender ID), sender must be confirmed before sending SMS message sender: '37062415654', //Phone number of recipient recipientPhoneNumber: '37066666661', //Message message: 'This is test message for first recipient!', //Should message be opened on receiver's screen flash: \Krisciunas\SmsBiuras\Message\SmsMessageInterface::FLASH_NOT_REQUIRED, //Is it test message test: \Krisciunas\SmsBiuras\Message\SmsMessageInterface::TEST_MODE_ENABLED, ); $result = $smsSender->send($apiKey, $userId, $message);
Getting result
send method of SmsSender class returns object implementing MessageLogRecordInterface.
You can use this object to check status of message sent:
$messageStatus = $result->getStatusCode(); $messageId = $result->getMessageId();
If message was successfully sent, $messageId will be not null. If error occured, $messageStatus will be the code of error. Check list of error codes here
Examples
You can find working example in src/examples/sendSmsMessages.php
Replace [API_KEY], [USER_ID] with yours and run example:
php sendSmsMessages.php
Authors
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-03