ridvanbaluyos/sms
Composer 安装命令:
composer require ridvanbaluyos/sms
包简介
A PHP Library built for making SMS sending easier.
README 文档
README
An SMS Provider Library for PHP
Installation
Open your composer.json file and add the following to the require key:
"ridvanbaluyos/sms": "v0.6-alpha"
After adding the key, run composer update from the command line to install the package
composer update
Or simply add:
composer require ridvanbaluyos/sms
Make sure you register for an account and load up your balance.
Configuration
- Go to
src/ridvanbaluyos/sms/configfolder. - Rename
default.providers.jsontoproviders.json. - Fill-up the necessary fields. You need not fill up all providers, only those that you are using.
"Semaphore" : {
"url" : "http://api.semaphore.co/api/sms",
"from" : "Justin Bieber",
"api" : "1$1++0074+3n0w+0$4ychUR1-cHUr1'x"
},
- In the same folder, open
distributions.jsonand fill up the weights. The total value should be 1.0.
{
"PromoTexter" : "0.5",
"Semaphore" : "",
"RisingTide" : "0.5",
"Chikka" : ""
}
Usage
Sending SMS with Provider
use ridvanbaluyos\sms\Sms as Sms; use ridvanbaluyos\sms\providers\PromoTexter as PromoTexter; $message = 'this is a test message'; $phoneNumber = '639123456789'; $provider = new PromoTexter(); $sms = new Sms($provider); $sms->send($phoneNumber, $message);
Sending SMS with No Provider
use ridvanbaluyos\sms\Sms as Sms; $message = 'this is a test message'; $phoneNumber = '639123456789'; $sms = new Sms(); $sms->send($phoneNumber, $message);
When no SMS provider is specified, it will be randomized based on the weights that you defined in the
distribution.jsonfile (eg. 0.25 is 25% chance).
Account Balance
use ridvanbaluyos\sms\Sms as Sms; $provider = new PromoTexter(); $sms = new Sms($provider); $sms->balance();
Supported SMS Providers
To Follow
- More SMS Providers!
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-12-08