PHP SDK (wa-ma/sdk-php)
Install the general-purpose PHP client and send text or media from your web application.
Installation
Install the package in your PHP project using Composer:
bash
composer require wa-ma/sdk-phpSend a text message
Initialize the Wama\Wama client using your instance API key from the WAMA dashboard, then call sendText():
php
use Wama\Wama;
$wama = new Wama('YOUR_WHATSAPP_API_KEY');
$res = $wama->sendText('966501234567', 'Hello from WAMA PHP SDK! 🚀');
if ($res['success']) {
echo "Queued successfully. ID: " . $res['id'];
} else {
echo "Error: " . $res['message'];
}Send media attachments
Pass a web URL, local file path, resource stream, or raw binary string. The SDK resolves media format and content types to base64 Data URIs automatically:
php
// Send remote image
$wama->sendImage('966501234567', 'https://example.com/banner.png', 'Look at this!');
// Send local file
$wama->sendDocument('966501234567', './invoice.pdf', 'Your Invoice');Instance Management
If you need to manage your accounts, instances, or fetch message history logs, use the Wama\WamaManager client:
php
use Wama\WamaManager;
$manager = new WamaManager(123, 'YOUR_USER_API_KEY');
// List linked instances
$instances = $manager->getInstances();
// Get status
$status = $manager->getStatus('instance_id');