ahmedtaha-dev/whatsapp-bevatel-provider
Composer 安装命令:
composer require ahmedtaha-dev/whatsapp-bevatel-provider
包简介
A package for integrating with Bevatel WhatsApp API
README 文档
README
PHP helpers for sending template messages through the Bevatel WhatsApp API from Laravel (or any app using Laravel’s HTTP client and config).
Requirements
- PHP
^8.1 - Laravel
^9…^12(package depends onilluminate/supportandilluminate/http)
Installation
composer require ahmedtaha-dev/whatsapp-bevatel-provider
Configuration
Environment variables
Set these in .env (or your runtime):
| Variable | Description |
|---|---|
BEVATEL_ACCOUNT_ID |
Account identifier sent as api_account_id |
BEVATEL_ACCESS_TOKEN |
Token sent as api_access_token |
BEVATEL_URL |
Full URL of the Bevatel WhatsApp send endpoint (POST) |
Publish config (optional)
php artisan vendor:publish --tag=whatsapp-config
This copies config/whatsapp.php, which reads the same env keys above.
Register the service provider
The package does not declare Laravel auto-discovery. Register it manually:
Laravel 11+ — in bootstrap/providers.php:
AhmedTaha\WhatsAppBevatel\WhatsAppServiceProvider::class,
Laravel 9–10 — in config/app.php under providers:
AhmedTaha\WhatsAppBevatel\WhatsAppServiceProvider::class,
Optional: register the facade alias in config/app.php (aliases) so you can call WhatsApp::message() instead of resolving WhatsappService manually:
'WhatsApp' => AhmedTaha\WhatsAppBevatel\Facades\WhatsApp::class,
Usage
Build a template payload with WhatsappMessageBuilder, then call send() to POST JSON to BEVATEL_URL with the headers Bevatel expects (api_account_id, api_access_token, Content-Type: application/json).
Minimal example (template + phone + inbox)
use AhmedTaha\WhatsAppBevatel\Enums\WhatsappTemplateLanguage; use AhmedTaha\WhatsAppBevatel\WhatsappService; /** @var WhatsappService $whatsapp */ $whatsapp = app(WhatsappService::class); $response = $whatsapp->message() ->setInboxId('your-inbox-id') ->setPhone('966501234567') ->setTemplate('your_template_name', WhatsappTemplateLanguage::EnUs) ->send(); if ($response->successful()) { // handle success } else { // $response->status(), $response->body(), etc. }
Body parameters
Map template body placeholders to the API shape your Bevatel template expects (often an array of parameter objects):
$whatsapp->message() ->setInboxId('...') ->setPhone('...') ->setTemplate('order_update', WhatsappTemplateLanguage::Ar) ->setBody([ // structure must match Bevatel / your approved template ]) ->send();
Header and media
use AhmedTaha\WhatsAppBevatel\Enums\WhatsappMediaType; $whatsapp->message() // ... ->setHeader([ /* header parameters */ ]) ->setMedia( 'https://example.com/file.pdf', WhatsappMediaType::Document, 'invoice.pdf' ) ->send();
Buttons
Each addButton() sets one button (index increments automatically):
use AhmedTaha\WhatsAppBevatel\Enums\WhatsappButtonSubType; $whatsapp->message() // ... ->addButton(WhatsappButtonSubType::QuickReply, 'Yes') ->addButton(WhatsappButtonSubType::Url, 'Open link') ->send();
Enums
WhatsappTemplateLanguage:EnUs(en_US),Ar(AR)WhatsappMediaType:Image,DocumentWhatsappButtonSubType:Url,QuickReply,CopyCode
Exact template names, languages, and parameter shapes must match what Bevatel approved for your WhatsApp Business account.
Response
send() returns Illuminate\Http\Client\Response from Laravel’s HTTP client, so you can use successful(), json(), body(), status codes, etc.
License
MIT. See the package composer.json if a separate license file is added later.
ahmedtaha-dev/whatsapp-bevatel-provider 适用场景与选型建议
ahmedtaha-dev/whatsapp-bevatel-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ahmedtaha-dev/whatsapp-bevatel-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahmedtaha-dev/whatsapp-bevatel-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 37
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-09