flotz / txtlocal
TxtLocal.co.uk 的包装器
1.0.0
2015-01-22 18:20 UTC
Requires
- php: >=5.2
- symfony/framework-bundle: 2.*
This package is not auto-updated.
Last update: 2024-09-28 16:41:30 UTC
README
这是一个为 Text Local 设计的简单的 Symfony Bundle 包装器,附带一些配置。
安装
在你的 composer.json
文件中,添加
{ "require": { "flotz/txtlocal" : "dev-master" } }
在你的 app/AppKernel.php
文件中,添加
{ ... new Flotz\TxtLocalBundle\FlotzTxtLocalBundle(), ... }
在你的 app/config/config.yml
flotz_txt_local: username: your@email.com hash: "hash key here as provided by TextLocal" test: false # This is optional (default is true) apiKey: "api key here as provided by TextLocal" # This is optional
然后更新你的 composer
$ composer update
用法
从 symfony 控制器中
// Note: $number could be a simple mobile number: $number = '447123123123'; // or a comma separated serie of numbers: $number = '447123123123, 447500400600'; // or an array of numbers: $number = array('447123123123', '447500400600'); // $message is the content of the received SMS $message = 'Thank you for using this bundle'; // $sender is the name that will appear as a sender $sender = 'Florent'; $this->get('flotz_txtlocal')->sendSms($number, $message, $sender); $balance = $this->get('flotz_txtlocal')->getBalance();