mrbase/smesg
Composer 安装命令:
composer require mrbase/smesg
包简介
Providing wrappers for danish sms gateways
关键字:
README 文档
README
Smesg is a library to help you send sms messages via different providers.
Currently supported providers:
So far the library only supports sending sms messages, querying for status, canceling and other services will be added.
Installation
Install via composer:
{
"require": {
"mrbase/smesg": "*"
}
}
or clone this repository:
git clone https://github.com/mrbase/Smesg.git Smesg
Usage
First off, you need a contract with one of the provides for you to be able to send anything.
You really sould use a psr-0 compliant autoloader, it will make your day.
A simple one can be found in tests/autoloader.php.
Then you need to set the configure variables for the provider (explained in details below) and provide the transport adapter.
Currently only one transport adapter exists, but you can add your own by implementing the Smesg\Adapter\AdapterInterface.
Unwire example:
<?php require __DIR__ . '/tests/autoloader.php'; $config = array( 'user' => 'test', 'password' => 'test....', 'appnr' => '1212', 'mediacode' => 'test', 'price' => '0.00DK', ); $transport = new Smesg\Adapter\PhpStreamAdapter(); $provider = new Smesg\Provider\UnwireProvider($transport, $config); $provider->addMessage('mobile_number', 'message'); $response = $provider->send();
Note, the mobile_number must be a valid MSISDN compliant number or the service will fail!
In-depth docs for the providers
inmobile:
The provider for inmobile implements the following services:
- smspush
- smspushxml
- smsclookup (you need a seperate agreement to have access to this service)
smspush: is used to send single messages.
smspushxml: is used when sending batch messages, note that you can only send 1024 messages in one batch, the provider does not handle the split into seperate batches.
smsclookup: is used to loockup serviceproviders for mobile numbers. implementing a cache for this is on the todo list.
Default configuration values:
<?php $config = array( 'user' => '', 'password' => '', 'appnr' => '', 'mediacode' => '', 'price' => '', 'get_smsc' => false, );
Please note that the price format uses period (.) as decimal devider.
Example: 0.00DKK is the correct value if you do not tax the messages in Denmark.
Possible default values when sending batch messages:
$defaults = array( 'operator' => null, 'shortcode' => null, 'mediacode' => null, 'price' => array( 'amount' => null, 'currency' => null, 'vat' => null, ), 'content' => null, );
If left alone the price array will be calculated from the value set in the configuration.
If you want to send the same message to a group of people you have the posibility to setup defaults for the messages.
Here is a simple example extending the demo above.
<?php // .... $provider = new Smesg\Provider\UnwireProvider($transport, $config); $provider->setDefaults(array( 'shortcode' => '1212', 'mediacode' => 'test', 'content' => 'this is the message send', )); $provider->addMessage('mobile_number_1', null); $provider->addMessage('mobile_number_2', null); $provider->addMessage('mobile_number_3', null); $response = $provider->send();
mrbase/smesg 适用场景与选型建议
mrbase/smesg 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.25k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2012 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「gateway」 「communication」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrbase/smesg 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrbase/smesg 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrbase/smesg 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Dispatcher to handle e-mail and instant notifications.
Package to publish/consume domain events messages from Laravel apps
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Manage Node resources from PHP
统计信息
- 总下载量: 3.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2012-03-12