承接 ecare/sms 相关项目开发

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

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

ecare/sms

最新稳定版本:v1.0.2

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 ✓

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固