承接 anhtuan92na/fpt-sms 相关项目开发

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

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

anhtuan92na/fpt-sms

最新稳定版本:v1.0.0

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.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固