定制 ecare/sms 二次开发

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

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

ecare/sms

Composer 安装命令:

composer require ecare/sms

包简介

Laravel package for Ecare SMS API integration

README 文档

README

Version: 1.0.0

A comprehensive Laravel package for integrating the Ecare SMS API. Send SMS messages, manage campaigns, and track message status programmatically.

Features

  • ✅ Send SMS to single or multiple recipients
  • ✅ Send SMS campaigns using contact lists
  • ✅ Retrieve SMS and campaign details
  • ✅ View all messages with pagination
  • ✅ Laravel Facade support
  • ✅ Easy configuration
  • ✅ Fluent API design

Installation

Via Composer

composer require ecare/sms

Installation

  1. Publish the configuration file:
php artisan vendor:publish --tag=ecaresms-config
  1. Update your .env file:
ECARE_SMS_API_TOKEN=your_api_token_here
ECARE_SMS_SENDER_ID=YourCompanyName
ECARE_SMS_TIMEOUT=30
ECARE_SMS_BASE_URL_V3=https://send.ecaresms.com/api/v3
ECARE_SMS_BASE_URL_HTTP=https://send.ecaresms.com/api/http

Usage

Basic Setup

The package is automatically registered in Laravel 5.5+. If you're using an older version, add the service provider to your config/app.php:

'providers' => [
    // ...
    EcareSms\EcareSmsServiceProvider::class,
],

'aliases' => [
    // ...
    'EcareSms' => EcareSms\Facades\EcareSms::class,
]

Sending SMS

Send to Single Recipient

use EcareSms\Facades\EcareSms;

$response = EcareSms::sendSms(
    recipient: '31612345678',
    senderID: 'YourName',
    message: 'This is a test message'
);

// Response structure
// {
//     "status": "success",
//     "data": "sms reports with all details"
// }

Send to Multiple Recipients

$response = EcareSms::sendSms(
    recipient: '31612345678,8801721970168',
    senderID: 'YourName',
    message: 'This is a test message'
);

Send with Scheduled Time

$response = EcareSms::sendSms(
    recipient: '31612345678',
    senderID: 'YourName',
    message: 'This is a scheduled message',
    options: [
        'schedule_time' => '2021-12-20 07:00'
    ]
);

Send with DLT Template

$response = EcareSms::sendSms(
    recipient: '31612345678',
    senderID: 'YourName',
    message: 'This is a DLT message',
    options: [
        'dlt_template_id' => 'your_template_id'
    ]
);

Sending Campaigns

Send to Contact List

$response = EcareSms::sendCampaign(
    contactListID: '6415907d0d37a',
    senderID: 'YourName',
    message: 'Campaign message to contact list'
);

Send Campaign to Multiple Contact Lists

$response = EcareSms::sendCampaign(
    contactListID: '6415907d0d37a,6415907d0d7a6',
    senderID: 'YourName',
    message: 'Campaign message'
);

Send Scheduled Campaign

$response = EcareSms::sendCampaign(
    contactListID: '6415907d0d37a',
    senderID: 'YourName',
    message: 'Scheduled campaign',
    options: [
        'schedule_time' => '2021-12-20 07:00'
    ]
);

Retrieving Messages

Get Single SMS by ID

$response = EcareSms::getSms('606812e63f78b');

// Response
// {
//     "status": "success",
//     "data": "sms data with all details"
// }

Get All Messages

$response = EcareSms::getAllMessages();

// Response
// {
//     "status": "success",
//     "data": "sms reports with pagination"
// }

Get Campaign Details

$response = EcareSms::getCampaign('606812e63f78b');

// Response
// {
//     "status": "success",
//     "data": "campaign data with all details"
// }

Dependency Injection

Use dependency injection in your controllers and services:

<?php

namespace App\Http\Controllers;

use EcareSms\Services\EcareSmsService;

class SmsController extends Controller
{
    public function send(EcareSmsService $smsService)
    {
        $response = $smsService->sendSms(
            '31612345678',
            'YourName',
            'Hello World!'
        );

        return response()->json($response);
    }
}

Error Handling

use EcareSms\Facades\EcareSms;
use Exception;

try {
    $response = EcareSms::sendSms(
        '31612345678',
        'YourName',
        'Test message'
    );

    if ($response['status'] === 'success') {
        // Handle success
        echo "SMS sent successfully";
    } else {
        // Handle API error
        echo "Error: " . $response['message'];
    }
} catch (Exception $e) {
    // Handle exception
    echo "Exception: " . $e->getMessage();
}

API Parameters Reference

Send SMS Endpoint

Parameter Required Type Description
recipient Yes string Phone number(s). Use comma for multiple: 31612345678,8801721970168
sender_id Yes string Sender name (max 11 chars for alphanumeric) or phone number
type Yes string Must be plain for text messages
message Yes string SMS message body
schedule_time No datetime Scheduled time in format Y-m-d H:i
dlt_template_id No string DLT template ID for regulatory compliance

Send Campaign Endpoint

Parameter Required Type Description
contact_list_id Yes string Contact list ID(s). Use comma for multiple
sender_id Yes string Sender name (max 11 chars) or phone number
type Yes string Must be plain for text messages
message Yes string Campaign message body
schedule_time No datetime Scheduled time in format Y-m-d H:i
dlt_template_id No string DLT template ID

Testing

composer test

Or with coverage:

composer test -- --coverage

Configuration Options

The configuration file (config/ecaresms.php) allows you to customize:

  • api_token: Your Ecare SMS API token
  • default_sender_id: Default sender identifier
  • timeout: HTTP timeout for requests

Environment Variables

ECARE_SMS_API_TOKEN=your_api_token
ECARE_SMS_SENDER_ID=YourName
ECARE_SMS_TIMEOUT=30

Response Format

All API responses follow this structure:

Success Response

{
  "status": "success",
  "data": "message or campaign data"
}

Error Response

{
  "status": "error",
  "message": "A human-readable description of the error"
}

API Documentation

For more information, visit the official Ecare SMS API Documentation

License

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

Support

For issues, questions, or feature requests, please contact:

Security

If you discover a security vulnerability, please send an email to security@ecaresms.com instead of using the issue tracker.

Changelog

See CHANGELOG.md for all notable changes.

Credits

  • Developed for Ecare SMS
  • Laravel integration by Ecare SMS Team

Version: 1.0.0 Released: March 27, 2026 Status: Production Ready ✓

ecare/sms 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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