承接 ahmedsalah/kenda-communication-plugin 相关项目开发

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

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

ahmedsalah/kenda-communication-plugin

最新稳定版本:0.4

Composer 安装命令:

composer require ahmedsalah/kenda-communication-plugin

包简介

kenda-communication-plugin

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Overview

The Kenda Communication Plugin is a Laravel package designed to facilitate communication between your Laravel application and WhatsApp services. It provides a structured way to register devices, websites, and functions, ensuring secure and seamless integration with remote servers.

Installation

You can install the package via Composer:

composer require ahmedsalah/kenda-communication-plugin

Configuration

Publish the configuration file using the following command:

php artisan vendor:publish --tag="kenda-communication-plugin-config"

This will create a configuration file containing:

return [

    'api_key' => env('KENDA_COMMUNICATION_PLUGIN_API_KEY', 'kn-...'),
    'from_phone' => env('KENDA_COMMUNICATION_PLUGIN_FROM_PHONE', '254712345678'),
    
    'public_key_path' => env('KENDA_COMMUNICATION_PLUGIN_PUBLIC_KEY_PATH', 'public_key_server.kendaKey'),

    'enable_user_resolving' => env('KENDA_COMMUNICATION_PLUGIN_ENABLE_USER_RESOLVING', true),
    'enable_guest_user' => env('KENDA_COMMUNICATION_PLUGIN_ENABLE_GUEST_USER', true),

    'user_model' => env('KENDA_COMMUNICATION_PLUGIN_USER_MODEL', 'App\Models\User'),
    'user_phone_number_column' => env('KENDA_COMMUNICATION_PLUGIN_USER_PHONE_NUMBER_COLUMN', 'phone_number'),

    'functions' => [
        'example_function' => 'App\KendaCommunicationPlugin\Functions\ExampleFunction',
    ],
];

Usage

1. Register a New Device

To begin, you must register a WhatsApp number (Device) with the server.

2. Register Your Website

Once the device is registered, register your website on the server. This allows your website to communicate with the API and receive user requests.

3. Register Your Functions

Functions must be registered on the server to allow your Laravel application to execute them remotely.

4. Map Local Functions to Remote Server Functions

Each registered function must be mapped to a local function in your Laravel application.

Generate a function file:

php artisan kenda:generate-function

Then, map the function in the config file:

return [
    'functions' => [
        'createUser' => 'App\KendaCommunicationPlugin\Functions\CreateUser',
        'writeArticle' => 'App\KendaCommunicationPlugin\Functions\WriteArticle',
    ],
];

Additional Features

Sending WhatsApp Messages

You can send WhatsApp messages directly to users using the following function:

KendaCommunicationPlugin::sendWhatsappMessage(string $targetPhone, string $message);

This feature is useful for notifications and reminders. However, avoid excessive messaging to prevent getting blocked by WhatsApp.

Testing

Run the test suite using:

composer test

Changelog

Refer to the CHANGELOG for a record of recent changes.

Credits

License

This package is open-source under the MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固