PHPackages                             whatsapp-gateway/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. whatsapp-gateway/php-sdk

ActiveLibrary[API Development](/categories/api)

whatsapp-gateway/php-sdk
========================

PHP SDK for WhatsApp Gateway customer API and webhooks.

v0.1.0(1mo ago)03MITPHPPHP &gt;=8.0CI passing

Since May 10Pushed 1mo agoCompare

[ Source](https://github.com/Liffys/whatsapp-gateway-php)[ Packagist](https://packagist.org/packages/whatsapp-gateway/php-sdk)[ RSS](/packages/whatsapp-gateway-php-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

WhatsApp Gateway PHP SDK
========================

[](#whatsapp-gateway-php-sdk)

SDK examples are available now. Official package releases are being prepared.

This private beta scaffold provides a small PHP client for the WhatsApp Gateway customer API and customer webhooks. It talks only to WhatsApp Gateway public endpoints.

Installation
------------

[](#installation)

During private beta, copy this package into your project or use it from a private repository.

Do not use a public package install command until an official package release is announced.

Examples
--------

[](#examples)

Example scripts are available in the `examples/` directory:

- `examples/send-message.php`
- `examples/verify-webhook.php`
- `examples/parse-webhook-event.php`

Tests
-----

[](#tests)

The package includes `phpunit.xml` and no-live-network tests. After installing development dependencies, run:

```
vendor/bin/phpunit
```

Configure The Client
--------------------

[](#configure-the-client)

```
use WhatsAppGateway\Client;

$client = new Client([
    'api_key' => 'wg_live_replace_with_your_key',
    'base_url' => 'https://evoapi.faisak.com',
    'timeout' => 15,
]);
```

Send A Message
--------------

[](#send-a-message)

```
$result = $client->sendMessage([
    'instance_id' => 'demo-support-line',
    'phone' => '+9665XXXXXXX',
    'message' => 'Your support request has been updated.',
    'message_purpose' => 'support',
]);

echo $result['message_id'] ?? '';
```

Allowed `message_purpose` values:

- `transactional`
- `operational`
- `support`
- `internal_team`
- `authentication`

Not allowed:

- `marketing`
- `promotion`
- `cold_outreach`
- `bulk_campaign`
- `political`
- `unknown`

Handle API Errors
-----------------

[](#handle-api-errors)

```
use WhatsAppGateway\ApiException;

try {
    $client->sendMessage([
        'instance_id' => 'demo-support-line',
        'phone' => '+9665XXXXXXX',
        'message' => 'Your order has shipped.',
        'message_purpose' => 'transactional',
    ]);
} catch (ApiException $exception) {
    echo $exception->getErrorCode();
    echo $exception->getMessage();
}
```

Common error codes include `module_not_enabled`, `message_purpose_not_allowed`, `recipient_suppressed`, `sending_throttled`, and `gateway_send_failed`.

Verify Webhook Signatures
-------------------------

[](#verify-webhook-signatures)

```
use WhatsAppGateway\Webhooks;

$rawBody = file_get_contents('php://input') ?: '';
$timestamp = $_SERVER['HTTP_X_WHATSAPP_GATEWAY_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_WHATSAPP_GATEWAY_SIGNATURE'] ?? '';
$secret = 'replace_with_webhook_signing_secret';

if (!Webhooks::verifySignature($rawBody, $timestamp, $signature, $secret)) {
    http_response_code(401);
    exit('Invalid signature');
}
```

Preferred signature format:

```
X-WhatsApp-Gateway-Signature: sha256=

```

The HMAC input is:

```
timestamp + "." + raw_body

```

Parse `message.received`
------------------------

[](#parse-messagereceived)

```
use WhatsAppGateway\Webhooks;

$payload = Webhooks::parseEvent($rawBody);

if (Webhooks::eventType($payload) === 'message.received') {
    $from = $payload['from'] ?? '';
    $messageText = $payload['message_text'] ?? '';
    $timestamp = $payload['timestamp'] ?? '';
}
```

Parse `recipient.opted_out`
---------------------------

[](#parse-recipientopted_out)

```
$payload = Webhooks::parseEvent($rawBody);

if (Webhooks::eventType($payload) === 'recipient.opted_out') {
    $from = $payload['from'] ?? '';
    $reason = $payload['reason'] ?? 'recipient_requested_stop';
}
```

Responsible Messaging
---------------------

[](#responsible-messaging)

WhatsApp Gateway is for transactional, operational, support, internal team, and authentication-style messages. Marketing, cold outreach, political messaging, and bulk campaigns are not allowed.

Useful Links
------------

[](#useful-links)

-
-

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance94

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

30d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f310806c32075b54c7d8a42aaf0e9d07b942906a1d0b3602374e910c7ba3eac?d=identicon)[Liffys](/maintainers/Liffys)

---

Top Contributors

[![faisalakbar86](https://avatars.githubusercontent.com/u/62942661?v=4)](https://github.com/faisalakbar86 "faisalakbar86 (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/whatsapp-gateway-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/whatsapp-gateway-php-sdk/health.svg)](https://phpackages.com/packages/whatsapp-gateway-php-sdk)
```

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90923.5M35](/packages/facebook-php-business-sdk)[exsyst/swagger

A php library to manipulate Swagger specifications

35916.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
