承接 axolote-source/messages-sdk 相关项目开发

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

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

axolote-source/messages-sdk

Composer 安装命令:

composer require axolote-source/messages-sdk

包简介

SDK for AxMessages integration

README 文档

README

SDK for integration with the AxMessages messaging service from Axolote Source. This library facilitates sending WhatsApp messages and emails from Laravel applications.

Installation

You can install the package via Composer:

composer require axolote-source/messages-sdk

Configuration

To use this SDK in Laravel, you can publish the configuration file:

php artisan vendor:publish --provider="AxoloteSource\MessagesSdk\AxMessagesServiceProvider" --tag="config"

This will create a config/axMessages.php file. You can also configure the environment variables in your .env file:

AXMESSAGES_URL=https://api.ejemplo.com
AXMESSAGES_TOKEN=your-token-here
AXMESSAGES_DEBUG=false
AXMESSAGES_DISABLED=false

Configuration Variables

  • AXMESSAGES_URL: The base URL of the messaging service.
  • AXMESSAGES_TOKEN: Your authentication token.
  • AXMESSAGES_DEBUG: (Optional) Enables debug mode (detailed logs).
  • AXMESSAGES_DISABLED: (Optional) Disables the service globally.

Usage

The main class AxoloteSource\MessagesSdk\AxMessages provides static methods to interact with the services.

Send WhatsApp with Template

You can send a WhatsApp message using a predefined template:

use AxoloteSource\MessagesSdk\AxMessages;

$to = '521234567890';
$templateName = 'welcome_message';
$variables = [
    [
        'key' => 'user',
        'type' => 'text',
        'value' => 'John Doe',
    ],
]

$response = AxMessages::sendWhatsappTemplate($to, $templateName, $variables);

if ($response) {
    // Message sent successfully
    echo $response->id;
}

You can also use the fluid instance:

$response = AxMessages::sendWhatsapp()
    ->template($to, $templateName, $variables);

Send Email with Template

To send emails, use the sendEmailTemplate method:

use AxoloteSource\MessagesSdk\AxMessages;

$data = [
    'to' => 'user@example.com',
    'subject' => 'Welcome',
    'template' => 'welcome_email',
    'params' => [
        [
            'key' => 'name',
            'value' => 'John Doe'
        ]
    ]
];

$response = AxMessages::sendEmailTemplate($data);

Or through the instance:

$response = AxMessages::sendEmail()->template($data);

Testing (Mocking)

The SDK includes functionality to simulate message sending in testing environments, avoiding real requests.

use AxoloteSource\MessagesSdk\AxMessages;

// Activate fake mode
AxMessages::fake();

// These calls will not make real requests
AxMessages::sendWhatsappTemplate('...', '...');

// Verify if fake mode is being used
if (AxMessages::isFake()) {
    // ...
}

Debugging

You can manually activate debug mode to get more information in the logs in case of an error:

AxMessages::sendWhatsapp()->activeDebugMode()->template(...);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固