andreas-weber / php-sms
PHP的SMS库
1.0.2
2015-01-27 16:43 UTC
Requires
- php: >=5.3
- ext-curl: 0.0.0.*
Requires (Dev)
- phploc/phploc: ~2.0
- phpmd/phpmd: ~2.1
- phpunit/phpunit: ~4.4
- sebastian/phpcpd: ~2.0
- squizlabs/php_codesniffer: ~2.1
This package is not auto-updated.
Last update: 2024-09-14 15:46:45 UTC
README
PHP 5.3+ 的 SMS 库。
支持的短信服务提供商
功能
- 发送短信
- 接收短信(仅在网关支持入站短信时)
要求
检查已发送的 composer.json。
安装
只需将 andreas-weber/php-sms
添加到项目的 Composer composer.json
文件中作为依赖项。
使用方法
发送短信
use AndreasWeber\SMS\Core\Gateway;
use AndreasWeber\SMS\Core\Gateway\Adapter\SMSTrade;
use AndreasWeber\SMS\Core\Message;
// create gateway
$gateway = new Gateway(
new SMSTrade('XXXXXXXXXXXX'),
true
);
// create message
$message = new Message(
'+49160123456789',
'php-sms',
'Hello, how are you?'
);
// send message
$response = $gateway->send($message);
// print response
var_dump($response);
接收短信
use AndreasWeber\SMS\Core\Gateway;
use AndreasWeber\SMS\Core\Gateway\Adapter\TextAnywhere;
// create gateway
$gateway = new Gateway(
new TextAnywhere('XXXXXXXX', 'XXXXXXXX'),
true
);
// receive messages
$messages = $gateway->fetch('+49177123456789');
// print messages
var_dump($messages);
开发者
环境
启动
vagrant up
进入虚拟机
vagrant ssh
运行测试
cd /vagrant
vendor/bin/phpunit src/Test/
构建目标
vagrant@andreas-weber:/vagrant$ ant
Buildfile: /vagrant/build.xml
help:
[echo]
[echo] The following commands are available:
[echo]
[echo] | +++ Build +++
[echo] |-- build (Run the build)
[echo] | |-- dependencies (Install dependencies)
[echo] | |-- tests (Lint all files and run tests)
[echo] | |-- metrics (Generate quality metrics)
[echo] |-- cleanup (Cleanup the build directory)
[echo] |
[echo] | +++ Composer +++
[echo] |-- composer -> composer-download, composer-install
[echo] |-- composer-download (Downloads composer.phar to project)
[echo] |-- composer-install (Install all dependencies)
[echo] |
[echo] | +++ Testing +++
[echo] |-- phpunit -> phpunit-full
[echo] |-- phpunit-tests (Run unit tests)
[echo] |-- phpunit-full (Run unit tests and generate code coverage report / logs)
[echo] |
[echo] | +++ Metrics +++
[echo] |-- coverage (Show code coverage metric)
[echo] |-- phploc (Show lines of code metric)
[echo] |-- qa (Run quality assurance tools)
[echo] |-- |-- phpcpd (Show copy paste metric)
[echo] |-- |-- phpcs (Show code sniffer metric)
[echo] |-- |-- phpmd (Show mess detector metric)
[echo] |
[echo] | +++ Metric Reports +++
[echo] |-- phploc-report (Generate lines of code metric report)
[echo] |-- phpcpd-report (Generate copy paste metric report)
[echo] |-- phpcs-report (Generate code sniffer metric report)
[echo] |-- phpmd-report (Generate mess detector metric report)
[echo] |
[echo] | +++ Tools +++
[echo] |-- lint (Lint all php files)
[echo]
想法
非常欢迎拉取请求。用爱构建。希望你会喜欢.. :-)