ruangdata/waba-php-sdk

WABA PHP SDK for RuangData WhatsApp Business API

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

pkg:composer/ruangdata/waba-php-sdk

1.0.3 2025-12-06 08:04 UTC

This package is not auto-updated.

Last update: 2026-01-03 01:29:29 UTC


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.json in 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).