kch//smsapi-bundle

SMSApi PHP 客户端库的 Symfony 2 Bundle。

安装数: 8,323

依赖关系: 0

建议者: 0

安全性: 0

星标: 1

关注者: 5

分支: 0

类型:symfony-bundle

1.6.2 2016-06-01 07:46 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:36:59 UTC


README

SMSApi PHP 客户端库的 Symfony 2 Bundle。

SMSApi PHP 客户端库的 Symfony 2 Bundle。

安装

composer require kch/smsapi-bundle

配置 - config.yml

kch_sms_api:
    clients:
        default:
            client_login: TEST
            client_password_hash: TEST

使用 - 发送一条短信

基于原始库代码:https://github.com/smsapi/smsapi-php-client/wiki/Examples

$smsFactory = $this->get('kch_sms_api.sms_factory.default');

try {
    $actionSend = $smsFactory->actionSend();

    $actionSend->setTo('600xxxxxx');
    $actionSend->setText('Hello World!!');
    $actionSend->setSender('Info'); //Pole nadawcy, lub typ wiadomości: 'ECO', '2Way'

    $response = $actionSend->execute();

    foreach ($response->getList() as $status) {
        echo $status->getNumber() . ' ' . $status->getPoints() . ' ' . $status->getStatus();
    }
} catch (SmsapiException $exception) {
    echo 'ERROR: ' . $exception->getMessage();
}