rc2c / the-callr-bundle
为 Symfony2 使用的 TheCallR SDK 套件。
dev-master
2014-05-05 13:53 UTC
Requires
- php: >=5.2.0
This package is not auto-updated.
Last update: 2024-09-28 15:39:24 UTC
README
先决条件
- PHP >= 5.2.0
- PHP JSON 扩展
- PHP cURL 扩展
安装
获取套件
使用 composer
{ "require": { "rc2c/the-callr-bundle": "dev-master" } }
初始化套件
要开始使用套件,请将套件注册到您应用程序的内核类中
// app/AppKernel.php public function registerBundles() { $bundles = array( // Thecallr new Rc2c\ThecallrBundle\Rc2cThecallrBundle() // ... ); )
配置套件
rc2c.the_callr.login: 'your_login' rc2c.the_callr.password: 'your_password' rc2c.the_callr.sender: 'THECALLR'
代码示例
// Load thecallr service $sms_Manager = $this->container->get('rc2c.the_callr'); // Your phone number (international format) $phone = '+33610111213'; // Your message (text) $message = 'your text message'; try { // Send sms $sms_Manager->send($phone, $message); } catch(Exception $e) { $this->logMessage($e->getCode().'-'.$e->getMessage(), 'err'); }