承接 digiworld/digichat-pure 相关项目开发

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

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

digiworld/digichat-pure

Composer 安装命令:

composer require digiworld/digichat-pure

包简介

Pure PHP client for DigiChat API

README 文档

README

Pure PHP (framework-agnostic) client for the DigiChat WhatsApp platform API.

  • ✅ No Laravel / no framework dependencies
  • ✅ Uses cURL (no Guzzle)
  • ✅ Typed response objects (DTO-style)
  • ✅ Suitable for CLI scripts, cron jobs, and any PHP app

Install: composer require digiworld/digichat-pure

Platform

DigiChat Platform: https://digichat.digiworld-dev.com

Requirements

  • PHP 8.1+
  • PHP extensions:
    • ext-curl
    • ext-json

Installation

composer require digiworld/digichat-pure

Quick Start

<?php

require __DIR__ . '/vendor/autoload.php';

use Digiworld\DigiChat\DigiChatClient;

$token  = 'YOUR_TOKEN';
$secret = 'YOUR_SECRET';

$client = new DigiChatClient($token, $secret);

// Ping
$ping = $client->ping();
var_dump($ping->success, $ping->message);

// Status
$status = $client->getStatus();
echo "Status: " . ($status->status ?? 'UNKNOWN') . PHP_EOL;

// Send a message
$send = $client->sendMessage('+31600000000', 'Hello from digichat-pure');
var_dump($send->success, $send->messageId, $send->status);

Usage

1) ping()

$res = $client->ping();
if ($res->success) {
    echo $res->message . PHP_EOL; // e.g. "pong"
}

Returns: OperationResponse

2) getStatus()

$res = $client->getStatus();
echo $res->status . PHP_EOL;          // e.g. READY / OFFLINE / ...
echo $res->progressPercent . PHP_EOL; // optional, if API returns progress

Returns: StatusResponse

3) getQr()

$res = $client->getQr();
echo $res->qr . PHP_EOL;          // QR text (if provided by API)
echo $res->imageBase64 . PHP_EOL; // Base64 QR image (if provided by API)

Returns: QrResponse

4) sendMessage($phone, $message, $options = [])

// phone number MUST not start with leading 0 or +
$res = $client->sendMessage('963900000000', 'Hello!');

echo $res. PHP_EOL;

Returns: SendMessageResponse

5) start()

$res = $client->start();
echo $res->message . PHP_EOL;

Returns: OperationResponse

6) refresh($withDeletion = false)

$res = $client->refresh(false);
echo $res->message . PHP_EOL;

Returns: OperationResponse

7) logout($withDeletion = false)

$res = $client->logout(false);
echo $res->message . PHP_EOL;

Returns: OperationResponse

8) getInviteInfo($inviteCode)

$res = $client->getInviteInfo('INV-123');

var_dump(
    $res->inviteCode,
    $res->valid
);

// Raw info payload (if present)
var_dump($res->info);

Returns: InviteInfoResponse

Responses (Typed DTOs)

All response objects extend BaseResponse and expose:

  • public readonly ?bool $success
  • public readonly ?string $message
  • public readonly array $raw (full raw response payload)

Example:

$res = $client->getStatus();

if ($res->success !== true) {
    // $res->raw has the full API payload for debugging
    var_dump($res->message, $res->raw);
}

Error Handling

The client throws DigiChatException for HTTP/network errors and non-2xx responses.

use Digiworld\DigiChat\Exceptions\DigiChatException;

try {
    $res = $client->sendMessage('963900000000', 'Hello');
} catch (DigiChatException $e) {
    echo $e->getMessage() . PHP_EOL;
    // if your exception stores details, dump them:
    // var_dump($e->getCode(), $e->details ?? null);
}

Base URL

The base URL is hardcoded inside the client (not user-configurable) by design.

Development

Local wrapper server (optional)

  1. Install dev deps:
composer install
  1. Create .env at package root:
DIGICHAT_TOKEN=YOUR_TOKEN
DIGICHAT_SECRET=YOUR_SECRET
  1. Run:
php -S 127.0.0.1:8000 -t dev-server/public

Then test endpoints (Postman/curl):

  • GET http://127.0.0.1:8000/api/ping
  • GET http://127.0.0.1:8000/api/status
  • POST http://127.0.0.1:8000/api/send-message

License

MIT

digiworld/digichat-pure 适用场景与选型建议

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

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

围绕 digiworld/digichat-pure 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-25