amirbagh75/smsir-php
Composer 安装命令:
composer require amirbagh75/smsir-php
包简介
Unofficial sms.ir PHP Package
README 文档
README
Unofficial PHP Package for sms.ir
Inspired by the official package. The official package just working in laravel! This package working in every PHP project
PHP Versions Supported: 7.3, 7.4, 8.0, 8.1
Laravel Versions Supported: 8, 9, 10
How to install:
composer require amirbagh75/smsir-php
Example (Pure PHP)
<?php require_once __DIR__ . '/../vendor/autoload.php'; use Amirbagh75\SMSIR\SmsIRClient; $apiKey = getenv('API_KEY'); $secretKey = getenv('SECRET_KEY'); $lineNumber = getenv('LINE_NUMBER'); $timeOut = 3; $smsir = new SmsIRClient($apiKey, $secretKey, $lineNumber, $timeOut); try { $res = $smsir->getSentMessages(1, 250); print_r($res->messages); print_r($res->countOfAll); } catch (Throwable $e) { error_log($e->getMessage(), 0); }
Example (Laravel)
First add these environment variables in your .env file:
SMSIR_API_KEY="xxxx"
SMSIR_SECRET_KEY="xxxx"
SMSIR_LINE_NUMBER="xxxx"
SMSIR_HTTP_TIMEOUT="10"
Then use it like the following example:
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class Example extends Controller { /** * Handle the incoming request. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function __invoke(Request $request) { // do something ... try { $res = SMSIR::getSentMessages('1399/06/01', '1399/10/01', 1, 250); dd($res); } catch (\GuzzleHttp\Exception\GuzzleException $e) { Log::error($e->getMessage()); } // do something ... } }
Current methods:
Response models structures are in the src/Responses directory
smsCredit(): CreditResponse getSMSLines(): SMSLinesResponse send(array $messages, array $mobileNumbers, $sendDateTime = null): SendResponse sendVerificationCode(string $code, string $mobileNumber): VerificationCodeResponse ultraFastSend(array $parameters, string $templateId, string $mobileNumber): VerificationCodeResponse getSentMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): SentMessagesResponse getReceivedMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): ReceivedMessagesResponse
Versioning
We use Semantic Versioning. See the available versions.
Authors
- Amirhossein Baghaie - Maintainer
- Ariaieboy - Collaborator
amirbagh75/smsir-php 适用场景与选型建议
amirbagh75/smsir-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.22k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2020 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sms」 「پ�」 「امک」 「اس ام اس」 「sendsms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amirbagh75/smsir-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amirbagh75/smsir-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amirbagh75/smsir-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
Alfabank REST API integration
Official Sms.ir Laravel Package
Official Sms.ir Laravel Package
统计信息
- 总下载量: 1.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-21