定制 sysborg/kingsms 二次开发

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

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

sysborg/kingsms

最新稳定版本:1.0.8.4

Composer 安装命令:

composer require sysborg/kingsms

包简介

Integração simples com a API da KingSMS para laravel

README 文档

README

Easily integrate KingSMS into your Laravel application.

This package simplifies the process of sending SMS, retrieving reports, checking balance, and receiving replies using the KingSMS API.

📦 Installation

Install the package via Composer:

composer require sysborg/kingsms

The service provider is auto-discovered by Laravel, so no need to manually add it to config/app.php.

⚙️ Configuration

Add your KingSMS credentials to your .env file:

KINGSMS_URL=https://painel.kingsms.com.br/kingsms/api.php
KINGSMS_LOGIN=your_login
KINGSMS_TOKEN=your_token

The default API URL is already set, but you can override it if needed.

🚀 Usage

Send SMS

use Facades\Sysborg\KingSMS\Services\KingSMS;

$response = KingSMS::sendSMS(
    '5598999999999', // Recipient phone number
    'Your message goes here', // Message content
    'Optional Campaign Name',
    'Optional Date (dd/mm/yyyy)',
    'Optional Time (hh:mm)'
);

Get SMS Report

$response = KingSMS::getRelatorio('your_sms_id');

Check Balance

$response = KingSMS::getSaldo();

Get SMS Replies

$response = KingSMS::getResposta('read'); // or 'unread'

🔔 Using as Notification Channel

You can also send SMS using Laravel's notification system.

1. Add toKingsms() method in your Notification:

public function via($notifiable)
{
    return ['kingsms'];
}

public function toKingsms($notifiable)
{
    return 'This is your notification message';
}

2. Your Notifiable Model must return the phone number

To let Laravel know which phone number to use, your notifiable model (usually User) must implement the following method:

public function routeNotificationForKingsms(): ?string
{
    // Example: clean Brazilian cellphone format and prepend +55
    $phone = preg_replace('/\D/', '', $this->celular); // or $this->phone
    return $phone ? '+55' . $phone : null;
}

Ensure your notifiable entity has a phone attribute or method.

🔗 Useful Links

👨‍💻 Author

Developed and maintained by:

Anderson Arruda
📧 andmarruda@gmail.com

Also maintained by:
Sysborg
📧 contato@sysborg.com.br

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固