zaptilo/whatsapp
Composer 安装命令:
composer require zaptilo/whatsapp
包简介
Zaptilo WhatsApp Business API SDK for PHP — Send text, media, and template messages via WhatsApp.
README 文档
README
Official PHP SDK for the Zaptilo WhatsApp Business API. Send text, media, and template messages via WhatsApp with a simple, clean API.
Installation
composer require zaptilo/whatsapp
Requirements: PHP 7.4+, cURL extension, JSON extension
Quick Start
use Zaptilo\WhatsApp\Zaptilo; $zaptilo = new Zaptilo('YOUR_API_TOKEN'); // Send a text message $response = $zaptilo->sendMessage('919876543210', 'Hello from Zaptilo!');
Get your API token from the Zaptilo Dashboard under Developer Tools > Access Tokens.
Usage
Send Text Message
$zaptilo->sendMessage('919876543210', 'Hello! Your order has been confirmed.');
Send Template Message
$zaptilo->sendTemplate( '919876543210', // Phone number 'order_update', // Template name 'en', // Language ['John', 'Shipped'], // Body parameter values ['#ORD-1234'] // Header parameter values (optional) );
Send Media Message
// Send image $zaptilo->sendMedia('919876543210', 'https://example.com/photo.jpg', 'image', 'Check this out!'); // Send document $zaptilo->sendMedia('919876543210', 'https://example.com/invoice.pdf', 'document', 'Your invoice'); // Send video $zaptilo->sendMedia('919876543210', 'https://example.com/video.mp4', 'video');
List Templates
$templates = $zaptilo->getTemplates(); foreach ($templates['data'] as $template) { echo $template['name'] . ' - ' . $template['status'] . PHP_EOL; }
Check Credit Balance
$result = $zaptilo->getBalance(); echo 'Balance: ' . $result['balance'];
Verify API Token
$result = $zaptilo->verify(); echo $result['message']; // "API key is valid and active"
Error Handling
use Zaptilo\WhatsApp\Zaptilo; use Zaptilo\WhatsApp\ZaptiloException; $zaptilo = new Zaptilo('YOUR_API_TOKEN'); try { $zaptilo->sendMessage('919876543210', 'Hello!'); } catch (ZaptiloException $e) { echo 'Error: ' . $e->getMessage(); echo 'Code: ' . $e->getCode(); }
Configuration
// Custom base URL (for self-hosted or staging) $zaptilo = new Zaptilo('YOUR_TOKEN', 'https://your-domain.com'); // Custom timeout (default: 30 seconds) $zaptilo = new Zaptilo('YOUR_TOKEN', 'https://zaptilo.ai', 60);
API Reference
| Method | Description |
|---|---|
sendMessage($number, $message) |
Send a text message |
sendMedia($number, $mediaUrl, $mediaType, $caption) |
Send image, video, or document |
sendTemplate($number, $templateName, $language, $bodyValues, $headerValues) |
Send a template message |
getTemplates() |
List all approved templates |
getBalance() |
Get current credit balance |
verify() |
Verify API token and subscription status |
Laravel Integration
Add your token to .env:
ZAPTILO_API_TOKEN=your_token_here
Create a service provider or use it directly:
use Zaptilo\WhatsApp\Zaptilo; $zaptilo = new Zaptilo(env('ZAPTILO_API_TOKEN')); $zaptilo->sendMessage('919876543210', 'Hello from Laravel!');
Links
License
MIT
zaptilo/whatsapp 适用场景与选型建议
zaptilo/whatsapp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「messaging」 「whatsapp」 「whatsapp-business」 「zaptilo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zaptilo/whatsapp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zaptilo/whatsapp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zaptilo/whatsapp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
PHP SDK for Mobile Message SMS API
Azure service bus Transport
Official PHP client for NATS messaging system
Laravel / Lumen package for Firebase Cloud Messaging
Ozioma for PHP library helps to make API calls to Ozioma Cloud Messaging and Communications Platform for birthday contact and sms newsletter subscription.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-01