WhatsApp PHP API
WAservix WhatsApp API Gateway has an official PHP client, tekservix/waservix on Packagist, and a plain REST API you can call with cURL. It needs PHP 7.4 or newer.
- Composer package
- cURL example
- Laravel guide
- WordPress plugin
PHP WhatsApp API client
composer require tekservix/waservixRequires PHP 7.4+ with the cURL and JSON extensions.
API WhatsApp PHP example
$ch = curl_init('https://tekservix.com/waservix/api/send-message');
curl_setopt_array($ch, [
CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('WASERVIX_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['to' => '+447700900123', 'text' => 'Hello from PHP']),
]);
echo curl_exec($ch);
Laravel and WordPress
See the Laravel guide and the free WordPress plugin for WooCommerce order messages.
Receiving WhatsApp messages in PHP
Incoming messages, delivery and read receipts arrive as JSON webhooks. Read the body with file_get_contents('php://input'), decode it with json_decode, verify it as described in the docs, then reply quickly with HTTP 200 and do slow work in a queue.
Sending images and documents from PHP
Add imageUrl or documentUrl and fileName to the JSON body. The file must be reachable over HTTPS; WAservix downloads it and sends it as a WhatsApp attachment, with text as the caption.
Pay per WhatsApp number, not per message
Every plan includes unlimited messages, the full API, webhooks, campaigns and auto-replies.
Not sure yet? Try WAservix free for 3 days — no card, one device, one number at a time, with a 2-minute wait between messages.
PHP questions
Which PHP version is needed?
PHP 7.4 or newer.
Is there a Composer package?
Yes: composer require tekservix/waservix.
Does it work on shared hosting?
Yes, if outgoing HTTPS requests are allowed.
Send WhatsApp from PHP today
Free for 3 days with no card: one number, one message at a time. Plans from $4.50/month after.
Get startedMore about WAservix: WAservix overview · WhatsApp API · WhatsApp Business API · WhatsApp API pricing · Free WhatsApp API trial · Send messages by API · WhatsApp link generator · WAservix vs Cloud API · API documentation guide · WhatsApp API providers · Alternatives · WhatsApp bot API · Integrations · Bulk messaging · Use cases · Calling API · Developer docs