kch/ /smsapi-bundle
SMSApi PHP 客户端库的 Symfony 2 Bundle。
1.6.2
2016-06-01 07:46 UTC
Requires
- php: >=5.3.0
- smsapi/php-client: 1.6.*
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();
}