pswincom / pswincom-bundle
PSWinCom Bundle 是 PSWINCom ruby gem 库的 PHP 端口/变体,该库支持发送短信的最小功能。
v0.1
2013-05-15 05:30 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-24 03:38:52 UTC
README
PSWinCom Bundle 是 PSWINCom ruby gem 库的 PHP 端口/变体。
此库支持发送短信的最小功能。
使用方法
简单示例
use PSWinCom\PSWinCom; // Load PSWinCom
// 1. Set options
$options = array();
$options['api_host'] = 'http://sms3.pswin.com/sms'; // set the host default is `http://sms.pswin.com/sms`
$options['username'] = "your_username";
$options['password'] = "your_password";
$options['sender'] = "SenderName/PhoneNumber";
// 2. Create a new instance
$pswin = new PSWinCom($options);
// 3. Send sms
$phone = '4712345678';
$message = 'Hello World';
$pswin->sendSms($phone, $message);
其他全局选项包括
`debug_mode`: If set to true message will not be sent, default value false
`country_code`: The country code to prefix phone numbers with, if the phone number is not prefixed with a country code it will be append if set. There is no default coutry code set.
与 Symfony2 一起使用
将以下内容添加到您的 deps 文件中。
[PSWinCom]
git=http://github.com/cristobal/pswincom-bundle
target=pswincom
然后运行 php bin/vendors install --reinstall
自动加载
将以下内容追加到您的 app/autoload.php
文件中,以确保 PSWinCom
命名空间被注册。
$loader->registerNamespaces(array(
…
'PSWinCom' => __DIR__.'/../vendor/pswincom/src/', // required to use the PSWinCom library
));