zen / skebby-bundle
Skebby短信网关
1.3.1
2018-06-26 07:56 UTC
Requires
- php: >=5.3.2
- guzzlehttp/guzzle: ~6.0
- symfony/framework-bundle: ~3.0|~4.0
This package is auto-updated.
Last update: 2024-09-11 18:56:40 UTC
README
什么是zen\skebby-bundle?
一个通过意大利Skebby公司提供短信网关的包。
安装
在 `composer.json
` 中使用
require:
"zen/skebby-bundle": "1.2.*"
在你的 `app/AppKernel.php
` 中添加
new Zen\Bundle\SkebbyBundle\SkebbyBundle()
在你的 `app/config/parameters.yml
` 中添加
skebby_username: myskebbyaccount # customize this
skebby_password: myskebbypass # customize this
在你的 `app/config/config.yml
` 中添加
skebby:
username: %skebby_username%
password: %skebby_password%
#
# if you want to simulate only the send,
# uncomment next line
# but a valid account is required
#test_mode: true
#
# if you want add prefix (not add if already present)
#add_prefix: '39'
#
# if you want clean phone number
#clean_regexp: '/[^0-9]/' (Remove non number chars)
使用
在你的控制器中使用
use Zen\Bundle\SkebbyBundle\Util\Skebby;
public function sendSmsAction()
{
$skebby = $this->getSkebby();
$text = "Hello!";
$result = $skebby->sendSMS(array('tel1', 'tel2', 'telx'), $text, Skebby::SMS_TYPE_CLASSIC);
}
/**
* Get Skebby service
*
* @return \Zen\Bundle\SkebbyBundle\Lib\ManagerSkebby
*/
private function getSkebby()
{
return $this->getContainer()->get('skebby');
}
你可以使用以下控制台命令
$ php app/console skebby:credit
$ php app/console skebby:sms:basic -d=<number1> -d=<number2> -d=<numberX> <text message>