anhtuan92na/fpt-sms 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

anhtuan92na/fpt-sms

Composer 安装命令:

composer require anhtuan92na/fpt-sms

包简介

FPT SMS API integration for Laravel

README 文档

README

Latest Version on Packagist Total Downloads License

A Laravel package for integrating with the FPT SMS API. Supports sending brandname SMS, OTP, advertising campaigns, and more.

Features

  • Send Brandname SMS (OTP, Ads, Priority)
  • Send MT Active SMS (standard & priority)
  • Create & manage advertising campaigns
  • Automatic access token caching (file, Redis, Memcached)
  • Sandbox & Production mode
  • Built-in logging
  • Artisan commands for testing & monitoring
  • Facade and Dependency Injection support

Requirements

  • PHP >= 8.1
  • Laravel >= 10.0

Installation

composer require anhtuan92na/fpt-sms

Publish the config file:

php artisan vendor:publish --tag=fpt-sms-config

Configuration

Add the following variables to your .env file:

FPT_SMS_CLIENT_ID=your_client_id
FPT_SMS_CLIENT_SECRET=your_client_secret
FPT_SMS_MODE=sandbox
FPT_SMS_TIMEOUT=30
FPT_SMS_CACHE=true
FPT_SMS_CACHE_DRIVER=file
FPT_SMS_LOG=true
FPT_SMS_LOG_CHANNEL=stack
Key Default Description
FPT_SMS_CLIENT_ID '' FPT Client ID
FPT_SMS_CLIENT_SECRET '' FPT Client Secret
FPT_SMS_MODE sandbox API mode: sandbox or live
FPT_SMS_TIMEOUT 30 Connection timeout (seconds)
FPT_SMS_CACHE true Enable access token caching
FPT_SMS_CACHE_DRIVER file Cache driver (file, redis, memcached)
FPT_SMS_LOG true Enable request logging
FPT_SMS_LOG_CHANNEL stack Laravel log channel

Verify your configuration:

php artisan fpt-sms:status

Usage

Facade

use FptSms\Facades\FptSms;

// Send OTP
$result = FptSms::sendBrandnameOtp('BrandName', '0912345678', 'Your OTP code is: 123456');

// Send advertising SMS
$result = FptSms::sendBrandnameAds('CAMPAIGN_CODE', '0912345678,0987654321');

// Create a campaign
$result = FptSms::createCampaign('BrandName', 'Campaign 1', 'Message content', '2025-12-01 08:00:00', 1000);

Dependency Injection

use FptSms\FptSmsClient;

class NotificationService
{
    public function __construct(
        private FptSmsClient $fptSms
    ) {}

    public function sendOrderConfirmation($order)
    {
        return $this->fptSms->sendBrandnameOtp(
            'ShopName',
            $order->customer->phone,
            "Order #{$order->id} has been confirmed"
        );
    }
}

Queue Job

use FptSms\FptSmsClient;

class SendSmsJob implements ShouldQueue
{
    use InteractsWithQueue, Queueable;

    public function __construct(
        public string $phone,
        public string $message
    ) {}

    public function handle(FptSmsClient $fptSms)
    {
        $fptSms->sendBrandnameOtp('BrandName', $this->phone, $this->message);
    }
}

// Dispatch
SendSmsJob::dispatch('0912345678', 'Hello')->onQueue('sms');

API Methods

Method Description
sendBrandnameOtp(brandName, phone, message) Send OTP SMS via brandname
sendBrandnameAds(campaignCode, phoneList) Send advertising SMS to a phone list
createCampaign(brandName, campaignName, message, scheduleTime, quota) Create an advertising campaign

Artisan Commands

Command Description
php artisan fpt-sms:status Check configuration status
php artisan fpt-sms:test Send a test SMS
php artisan fpt-sms:clear-cache Clear cached access token

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

anhtuan92na/fpt-sms 适用场景与选型建议

anhtuan92na/fpt-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sms」 「laravel」 「otp」 「fpt」 「brandname」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15