ruangdata/waba-php-sdk
最新稳定版本:1.0.3
Composer 安装命令:
composer require ruangdata/waba-php-sdk
包简介
WABA PHP SDK for RuangData WhatsApp Business API
README 文档
README
Simple PHP SDK for RuangData WhatsApp Business API. Ready to use in Laravel and CodeIgniter 4.
Install
If you're developing locally:
composer require ruangdata/waba-php-sdk
Or add repository path in your composer.json for local use during development.
Usage (Laravel)
Add credentials to .env:
WABA_APP_ID=your_app_id
WABA_APP_SECRET=your_app_secret
Add to config/services.php:
'waba' => [
'app_id' => env('WABA_APP_ID'),
'app_secret' => env('WABA_APP_SECRET'),
],
Example:
use RuangData\WABA\WABAClient;
$waba = new WABAClient(
config('services.waba.app_id'),
config('services.waba.app_secret'),
storage_path('waba')
);
$response = $waba->request('POST', '/messages/send', [
'to' => '628123456789',
'message' => 'Hello from SDK'
]);
Usage (CodeIgniter 4)
Put this in app/Config/Services.php:
public static function waba()
{
return new \RuangData\WABA\WABAClient(
getenv('WABA_APP_ID'),
getenv('WABA_APP_SECRET'),
WRITEPATH . 'waba'
);
}
Then:
$waba = service('waba');
$res = $waba->request('POST', '/messages/send', [
'to' => '628123456789',
'message' => 'Halo!'
]);
Notes
- The SDK stores tokens in
token_store.jsonin the storage path provided. - Make sure the storage path writable by your web server.
- You can extend this SDK by adding helpers for common endpoints (sendTemplate, sendMedia, getProfile, etc).
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-29