定制 fazland/skebby-rest-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fazland/skebby-rest-client

Composer 安装命令:

composer require fazland/skebby-rest-client

包简介

Unofficial Skebby Rest Client

README 文档

README

Test codecov

Fazland's Skebby Rest Client is an unofficial PHP Rest Client for the italian SMS GatewayProvider Skebby.

Requirements

  • php >= 7.4
  • php xml extension
  • symfony/options-resolver
  • giggsey/libphonenumber-for-php >= 8.0

Installation

The suggested installation method is via composer:

$ composer require fazland/skebby-rest-client

Using Skebby Rest Client

It's really simple. First of all, configuration!

Configuration

The mandatory configuration parameters are:

  • username
  • password
  • sender
  • method

Just create a Client object passing to the constructor the parameters as an array:

$this->skebbyRestClient = new Client([
    'username' => 'your_username',
    'password' => 'your_password',
    'sender' => '+393333333333',
    'method' => SendMethods::CLASSIC,
    'encoding_scheme' => EncodingSchemas::NORMAL,  // Optional
    'charset' => Charsets::UTF8,                   // Optional
    'endpoint_uri' => 'https://gateway.skebby.it/api/send/smseasy/advanced/rest.php' // (default)
]);

You can also set default values for delivery_start and validity_period, thus they can be overridden by the Sms object

Creating SMS:

To create an SMS just follow the example:

Sms::create()
    ->setRecipients([
        '+393473322444',
        '+393910000000'
    ])
    ->setRecipientVariables('+393473322444', [
        'name' => 'Mario',
        'quest' => 'Go and rescue Peach, Bowser kidnapped her!'
    ])
    ->setRecipientVariables('+393910000000', [
        'name' => 'Luigi',
        'quest' => 'Help Mario, Bowser is really bad!!'
    ])
    ->setText('Hey ${name}! ${quest}')
;

Send SMS!

Just use the Client::send(Sms $sms) method to send sms!

$client->send($sms);

Note:

A single client will send SMS through the method you specified in configuration. If you want to send it through another method, just create a new client.

Events

You can leverage your preferred event system, as long as it implements PSR-14. Just pass your dispatcher as third argument of Client constructor:

$dispatcher = new EventDispatcher();    // any dispatcher implementing EventDispatcherInterface
$options = [/* .. */];  // see above for detailed options
$this->skebbyRestClient = new Client($options, null, $dispatcher);

Each time an SMS is sent, a \Fazland\SkebbyRestClient\Event\SmsMessageEvent will be dispatched.

Test

Run

$ vendor/bin/phpunit

Contributing

Contributions are welcome. Feel free to open a PR or file an issue here on GitHub!

License

Skebby Rest Client is licensed under the MIT License - see the LICENSE file for details

fazland/skebby-rest-client 适用场景与选型建议

fazland/skebby-rest-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.11k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fazland/skebby-rest-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fazland/skebby-rest-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 fazland/skebby-rest-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 5
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-20