phpbook/sms
Composer 安装命令:
composer require phpbook/sms
包简介
PHP SMS Library For NEXMO, PLIVO, TWILIO
关键字:
README 文档
README
About SMS
- A lightweight SMS PHP library available for NEXMO, PLIVO e TWILIO.
Composer Install
composer require phpbook/sms
Declare Configurations
/******************************************** * * Declare Configurations * * ******************************************/ //Driver connection NEXMO \PHPBook\SMS\Configuration\SMS::setConnection('main', (new \PHPBook\SMS\Configuration\Connection) ->setName('Main') ->setExceptionCatcher(function(String $message) { //the PHPBook SMS does not throw exceptions, but you can take it here //you can store $message in database or something else }) ->setDriver((new \PHPBook\SMS\Driver\NEXMO) ->setKey('key') ->setSecret('secret') ->setFrom('00000000000')) ); //Driver connection PLIVO \PHPBook\SMS\Configuration\SMS::setConnection('notify', (new \PHPBook\SMS\Configuration\Connection) ->setName('Notify') ->setExceptionCatcher(function(String $message) { //the PHPBook SMS does not throw exceptions, but you can take it here //you can store $message in database or something else }) ->setDriver((new \PHPBook\SMS\Driver\PLIVO) ->setKey('key') ->setToken('token') ->setFrom('00000000000')) ); //Driver connection TWILIO \PHPBook\SMS\Configuration\SMS::setConnection('payments', (new \PHPBook\SMS\Configuration\Connection) ->setName('Payments') ->setExceptionCatcher(function(String $message) { //the PHPBook SMS does not throw exceptions, but you can take it here //you can store $message in database or something else }) ->setDriver((new \PHPBook\SMS\Driver\TWILIO) ->setKey('key') ->setToken('token') ->setFrom('00000000000')) ); //Set default connection by connection code \PHPBook\SMS\Configuration\SMS::setDefault('main'); //Getting connections $connections = \PHPBook\SMS\Configuration\SMS::getConnections(); foreach($connections as $code => $connection) { $connection->getName(); $connection->getDriver(); }; ?>
Sending SMS
//Connection code is not required if you set default connection //make sure the number contain the country code with plus and are code too. $boolean = (new \PHPBook\SMS\SMS) ->setConnectionCode('notify') ->setMessage( (new \PHPBook\SMS\Message) ->setTo(['+5547999999999', '+5547888888888']) ->setContent('Hi Jhon') ) ->dispatch(); if ($boolean) { //sent };
phpbook/sms 适用场景与选型建议
phpbook/sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sms」 「lightweight」 「fast」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phpbook/sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpbook/sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phpbook/sms 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
Splot Framework. Lightweight, fully featured framework for rapid web development.
yii2-sms expand
Alfabank REST API integration
PHP View Library
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-14