承接 mmdm/sim-fa-sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mmdm/sim-fa-sms

Composer 安装命令:

composer require mmdm/sim-fa-sms

包简介

A simple yet nice SMS library

README 文档

README

A library for iranian sms panels.

Attention

This is version alpha

Install

composer

composer require mmdm/sim-fa-sms

Or you can simply download zip file from github and extract it, then put file to your project library and use it like other libraries.

Just add line below to autoload files:

require_once 'path_to_library/autoloader.php';

and you are good to go.

How to use

For convenient it has a factory class that can instantiate appropriate class according to your panel. If there is no such panel type, it'll return null.

instance(int $type)

// SMSFactory from Sim\SMS\SMSFactory namespace
$panel = SMSFactory::instance(SMSFactory::PANEL_NIAZPARDAZ);

Or you can simply create an instance from a specific panel like a simple class

$niazPardaz = new \Sim\SMS\Factories\NiazPardaz();

Common methods

fromNumber(string $number)

If panel supports specifying your panel number, you can use this method.

$panel->fromNumber(your_panel_number);

credit($username, $password)

Usually SMS panels need username and password to connect.

$panel->credit(your_panel_username, your_panel_password);

setParameter(string $parameter_name, &$parameter_value)

Set extra or needed parameters to do related functionality

$panel->setParameter('fromNumber', your_panel_number);
// also you can set parameter like an object
$panel->fromNumber = your_panel_number;

getParameter(string $parameter_name, $prefer = null)

Get a parameter if is exists or returns $prefer

Note: When you use object accessing, it'll returns null and triggers error

$panel->getParameter('fromNumber');
// also you can get parameter like an object
$panelNumber = $panel->fromNumber;

send(MessageProvider $numbers)

Send message to some numbers.

MessageProvider is a class that have below methods
  • setNumbers(array $numbers)

      Set numbers that want send message to
    
  • getNumbers(): array

      Get numbers that want send message to
    
  • withBody(string $body)

      Specify the message to send
    
  • getBody(): string

      Get the message to send
    

getCredit(): float

Get sms panel credit

$creditCount = $panel->getCredit();

getStatus(): array

Get status after some operations like send.

The return will be in following structure:

[
  'code' => a code according to operation,
  'message' => a message according to code,
]

In some operations the status will be an array of previous structure.

[
  [
    'code' => a code according to operation,
    'message' => a message according to code,
  ],
  [
    'code' => a code according to operation,
    'message' => a message according to code,
  ],
  ...
]

isSuccessful(): bool

Return boolean to show if an operation is successful or not

// call after an operation
$isSuccessful = $panel->isSuccessful();

onError(Closure $callback)

Set a closure when an error happen. This closure have three parameters to access:

  • error code

  • error message

  • parameters of the functionality

$panel->onError(function ($code, $message, $parameters) {
  // do something
});

Supported panels:

  • NiazPardaz

NiazPardaz available methods

NiazPardaz methods

__construct(string $username = null, string $password = null)

$niazPardaz = new \Sim\SMS\Factories\NiazPardaz();
// or add credentioal information in construct
$niazPardaz = new \Sim\SMS\Factories\NiazPardaz(panel_username, panel_password);

For rest of methods please see documentation of the panel

getInboxCount(): int

sendBatchSms(MessageProvider $message)

getMessages()

getDelivery()

numberIsInTelecomBlacklist()

extractTelecomBlacklistNumbers()

sendSmsLikeToLike(array $message_providers)

getRecIds(): array

  • Use with send method

Add new panel

To add a new panel you can implement ISMS interface.

Or if you want to have some functionality you can extend AbstractSMS and add your new functionality for new panel.

License

Under MIT license.

mmdm/sim-fa-sms 适用场景与选型建议

mmdm/sim-fa-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 mmdm/sim-fa-sms 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-16