定制 cable8mm/laravel-sens 二次开发

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

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

cable8mm/laravel-sens

Composer 安装命令:

composer require cable8mm/laravel-sens

包简介

NCloud SENS notification channels for Lovely Laravel.

README 文档

README

Latest Stable Version Total Downloads License Tests

Laravel notification channels for NAVER Cloud Platform SENS.

This package is a maintained fork of seungmun/laravel-sens. The original package provided the foundation for sending SMS, MMS, and Kakao AlimTalk notifications through NCLOUD SENS. This fork keeps the package usable with current PHP and Laravel versions while preserving the existing public API as much as possible.

Features

  • SMS and LMS notifications
  • MMS notifications with file attachment support
  • Kakao AlimTalk notifications
  • Laravel notification channel integration
  • Auto-discovery service provider

Requirements

  • PHP 8.2 or higher for Laravel 10, 11, and 12
  • PHP 8.3 or higher for Laravel 13
  • Laravel 10, 11, 12, or 13
  • NCLOUD SENS credentials and service IDs

Installation

Install the package with Composer:

composer require cable8mm/laravel-sens

Laravel will automatically discover the service provider.

Publish the configuration file when you want to customize it:

php artisan vendor:publish --provider="Seungmun\Sens\SensServiceProvider" --tag="config"

Configuration

Add your NCLOUD SENS credentials to .env:

SENS_ACCESS_KEY=your-sens-access-key
SENS_SECRET_KEY=your-sens-secret-key
SENS_SERVICE_ID=your-sms-service-id
SENS_ALIMTALK_SERVICE_ID=your-alimtalk-service-id
SENS_PlUS_FRIEND_ID=@your-plus-friend-id

The SENS_PlUS_FRIEND_ID key keeps the spelling used by the original package configuration.

If you publish the configuration, it will be available at config/laravel-sens.php.

Usage

Use this package through Laravel's built-in notification system.

Sending SMS

Create a notification:

php artisan make:notification SendPurchaseReceipt

Return SmsChannel::class from via() and build an SmsMessage from toSms():

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Seungmun\Sens\Sms\SmsChannel;
use Seungmun\Sens\Sms\SmsMessage;

class SendPurchaseReceipt extends Notification
{
    use Queueable;

    public function via($notifiable): array
    {
        return [SmsChannel::class];
    }

    public function toSms($notifiable): SmsMessage
    {
        return (new SmsMessage())
            ->to($notifiable->phone)
            ->from('055-000-0000')
            ->content('Your purchase receipt is ready.')
            ->contentType('COMM')
            ->type('SMS');
    }
}

Send the notification as usual:

use App\Models\User;
use App\Notifications\SendPurchaseReceipt;

User::find(1)->notify(new SendPurchaseReceipt());

Sending MMS

Use type('MMS') and attach a file path or an Illuminate\Http\UploadedFile instance:

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Http\UploadedFile;
use Illuminate\Notifications\Notification;
use Seungmun\Sens\Sms\SmsChannel;
use Seungmun\Sens\Sms\SmsMessage;

class SendPurchaseInvoice extends Notification
{
    use Queueable;

    public function __construct(private UploadedFile $image)
    {
    }

    public function via($notifiable): array
    {
        return [SmsChannel::class];
    }

    /**
     * @throws FileNotFoundException
     */
    public function toSms($notifiable): SmsMessage
    {
        return (new SmsMessage())
            ->type('MMS')
            ->to($notifiable->phone)
            ->from('055-000-0000')
            ->content("This is your invoice.\nCheck out the attached image.")
            ->file('invoice.jpg', $this->image);
    }
}
use App\Models\User;
use App\Notifications\SendPurchaseInvoice;

User::find(1)->notify(new SendPurchaseInvoice(request()->file('image')));

Sending AlimTalk

Return AlimTalkChannel::class from via() and build an AlimTalkMessage from toAlimTalk():

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Seungmun\Sens\AlimTalk\AlimTalkChannel;
use Seungmun\Sens\AlimTalk\AlimTalkMessage;

class SendShippingNotice extends Notification
{
    use Queueable;

    public function via($notifiable): array
    {
        return [AlimTalkChannel::class];
    }

    public function toAlimTalk($notifiable): AlimTalkMessage
    {
        return (new AlimTalkMessage())
            ->templateCode('TEMPLATE001')
            ->to($notifiable->phone)
            ->content('Your order has been shipped.')
            ->countryCode('82')
            ->addButton(['type' => 'DS', 'name' => 'Tracking of Shipment'])
            ->setReserved('2026-05-31 14:20', 'Asia/Seoul');
    }
}

Compatibility Notes

The Composer package name is cable8mm/laravel-sens, but the PHP namespace remains Seungmun\Sens for backward compatibility with the original package.

If you are migrating from seungmun/laravel-sens, replace the Composer package and keep your existing notification code:

composer remove seungmun/laravel-sens
composer require cable8mm/laravel-sens

Contributing

Issues and pull requests are welcome. Please keep changes focused, include tests for behavior changes, and run the test suite before opening a pull request:

composer test
composer lint

Credits

License

This package is open-sourced software licensed under the MIT license.

cable8mm/laravel-sens 适用场景与选型建议

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

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

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

围绕 cable8mm/laravel-sens 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09