stanislav-web/phalcon-sms-factory
Composer 安装命令:
composer require stanislav-web/phalcon-sms-factory
包简介
Multiple gateway SMS Sender factory. Provide any SMS services inside your Phalcon's projects
README 文档
README
Description
This service makes SMS through a variety of providers. You can easily implement your own providers using the interface design. At the moment, provides an interface to send and check your balance for the next:
- BulkSMS
- Clickatell
- MessageBird
- Nexmo
- SmsAero
- SMSC
- SmsUkraine
- SMS.ru
Change Log
In Future
- Support SMS mass mailing
[v 1.2.3-stable] 2015-04-15
- Add single error handler
- Add SMS.ru provider
- Send SMS Unit Tests
[v 1.2.2-beta] 2015-02-08
- Add view balance
- Add development info (API) / UML
- Reformat to PSR-1/PSR-2
[v 1.1-beta] 2015-02-07
- Add response debugger (Show server response headers)
[v 1.0-beta] 2015-02-06
- Sending SMS use multiple providers
Compatible
- PSR-0, PSR-1, PSR-2, PSR-4 Standards
System requirements
- PHP 5.4 >
- Phalcon extension 1.3.x
- PHP libcurl or Stream Socket client
Install
First update your dependencies through composer. Add to your composer.json:
"require": { "stanislav-web/phalcon-sms-factory": "1.2.*@stable", }
Then run to update dependency and autoloader
php composer.phar update php composer.phar install
or just
php composer.phar require stanislav-web/phalcon-sms-factory 1.2.*@stable
(Do not forget to include the composer autoloader)
You can create an injectable service
$di->set('SMS', function () use ($di) { return new SMSFactory\Sender($di); });
Usage
Configure providers
SMS services have a variety of settings, both mandatory and optional. You can select them in the global configuration file of your project. I intentionally did not make the settings in each provider, as this service will be maintained and no time to change. Therefore, when updating via the composer, your settings will not be overwritten, if you will be making their to global application config. See example:
<?php // add to your app config and write down your settings .The key 'sms' is required 'sms' => [ 'Nexmo' => [ 'from' => '', 'api_key' => '', 'api_secret'=> '', 'type' => '', 'request_method' => '' ], 'BulkSMS' => [ 'username' => '', 'password' => '', ], 'SmsAero' => [ 'from' => '', 'user' => '', 'password' => '', ], 'SmsUkraine' => [ 'from' => '', 'login' => '', 'password' => '', 'version' => '', ], 'SMSC' => [ 'login' => '', 'psw' => '', 'charset' => '', 'sender' => '', ], 'SMSRu' => [ 'api_id' => '' ], 'Clickatell' => [ 'api_id' => '', 'user' => '', 'password' => '', 'from' => '', 'request_method' => '' ], 'MessageBird' => [ 'originator' => '', 'access_key' => '', 'request_method' => '' ] ];
Send SMS and view balance
Now you can call your created service of sending sms.
<?php // get sms service $sms = $this->di->get('SMS'); // send message via SmsAero (available 7 providers) $response = $sms->call('SmsAero')->setRecipient('NUMBER')->send('MESSAGE')); // get balance of SmsAero account $response = $sms->call('SmsAero')->balance(); // use debug to show headers $response = $sms->call('SmsProvider')->debug(true)->setRecipient('NUMBER')->send('MESSAGE')); $response = $sms->call('SmsProvider')->debug(true)->balance();
Unit Test
Also available in /phpunit directory. Run command to start
phpunit --configuration phpunit.xml.dist --coverage-text
Contributing and development
I have enclosed instructions API and related classes Diagram.
I am accept bug reports, new feature requests and pull requests in GitHub.
If you have a question about how to use this service, please see this README.
If you have a change or new feature in mind, please see this README again and follow DRI (development rules interfaces).
You can add new providers following interfaces:
You can add own or choise exists of request's client. Also available:
##Issues
stanislav-web/phalcon-sms-factory 适用场景与选型建议
stanislav-web/phalcon-sms-factory 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 1.58k 次下载、GitHub Stars 达 31, 最近一次更新时间为 2015 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「phalcon」 「phalcon sms」 「phalcon sms providers」 「phalcon send sms」 「phalcon sms service」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 stanislav-web/phalcon-sms-factory 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 stanislav-web/phalcon-sms-factory 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 stanislav-web/phalcon-sms-factory 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extended faker package providers
Load other service providers based on current environment
PHP geocoding for laravel 5 & 5.1 using Google API
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
Uniondrug Trace Client Component for uniondrug/framework
统计信息
- 总下载量: 1.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 32
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-02