zepson / whatsappcloud-php
PHP 最新 WhatsApp Cloud API 包装器
1.0.0
2022-05-22 07:31 UTC
Requires
- php: ^8.0|^7.4
- guzzlehttp/guzzle: ^7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- pestphp/pest: ^1.20
- spatie/ray: ^1.28
This package is auto-updated.
Last update: 2024-09-09 06:34:18 UTC
README
PHP 最新 WhatsApp Cloud API 包装器
开源 PHP 包装器,用于 WhatsApp Cloud API。
支持的特性
- 发送消息
- 发送媒体(图片、音频、视频和文档)
- 发送位置
- 发送交互式按钮
- 发送模板消息
安装
您可以通过 composer 安装此包
composer require zepson/whatsappcloud-php
用法
<?php require_once 'vendor/autoload.php'; use zepson\Whatsapp\WhatsappClass; $token = 'YOUR_META_WHATSAPP_APP_ACCESS_TOKEN'; $phone_number_id = '10726082513218961'; //send message $tsap = new WhatsappClass( $phone_number_id, $token); $sendtsap = $tsap->send_template('hello_world', '255654485755'); print_r($sendtsap);
所有可用方法
发送纯文本
send_message($message, $recipient_id)
从模板发送
send_template($template, $recipient_id, $lang = "en_US")
发送位置
sendLocation($lat, $long, $name, $address, $recipient_id)
发送图片
send_image($image, $recipient_id, $recipient_type = "individual", $caption = null, $link = true)
发送音频
send_audio($audio, $recipient_id, $link = true)
发送视频
send_video($video, $recipient_id, $caption = null, $link = true)
发送文档
send_document($document, $recipient_id, $caption = null, $link = true)
创建按钮
create_button($button)
发送按钮
public function send_button($button, $recipient_id)
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
通过贡献来提升更多功能和修复错误。
鸣谢
许可
MIT 许可证(MIT)。有关更多信息,请参阅许可文件。