PHPackages                             whapi-cloud/whatsapp-api-sdk-php - 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. whapi-cloud/whatsapp-api-sdk-php

ActiveLibrary[API Development](/categories/api)

whapi-cloud/whatsapp-api-sdk-php
================================

Sending and receiving messages using HTTP requests. Fixed price with no hidden fees, without limits and restrictions. You will be able to send and receive text/media/files/locations/goods/orders/polls messages via WhatsApp in private or group chats. Guides and SDK can be found on our website.

4662↓42.9%2PHP

Since Oct 28Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/Whapi-Cloud/whatsapp-api-sdk-php)[ Packagist](https://packagist.org/packages/whapi-cloud/whatsapp-api-sdk-php)[ RSS](/packages/whapi-cloud-whatsapp-api-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WhatsApp API PHP SDK Documentation
==================================

[](#whatsapp-api-php-sdk-documentation)

Sending and receiving messages using HTTP requests. Fixed price with no hidden fees, without limits and restrictions. You will be able to send and receive text/media/files/locations/goods/orders/polls messages via WhatsApp in private or Group chats.

For more information, please visit .

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

[](#installation)

Install the WhAPI PHP SDK using Composer:

```
composer require whapi-cloud/whatsapp-api-sdk-php
```

Initial Setup
-------------

[](#initial-setup)

To work with the API and develop the integration, you will need to know your API key, which you can get on the page of the channel you authorized (connected to the number). Go to the authorized channel in the [dashboard](https://panel.whapi.cloud/dashboard). Click to copy it and the API key will remain in your clipboard.

First, include the required libraries and initialize the client:

```
use OpenAPI\Client\Api\MessagesApi;
use OpenAPI\Client\Configuration;

// Initialize the client
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()
    ->setApiKey('token', "your_token")
    ->setAccessToken("your_token");

$apiInstance = new OpenAPI\Client\Api\MessagesApi(
    new GuzzleHttp\Client(),
    $config
);
```

Messages API
------------

[](#messages-api)

### Sending Text Messages

[](#sending-text-messages)

```
// Create text message object
$sender_text = new \OpenAPI\Client\Model\SenderText();
$sender_text->setTo('13016789891');        // Include country code
$sender_text->setBody('Your message here'); // Message content

// Optional parameters
$sender_text->setEphemeral(3600);     // Message visibility time in seconds
$sender_text->setViewOnce(true);      // View once setting
$sender_text->setTypingTime(5.0);     // Typing simulation duration
$sender_text->setNoLinkPreview(false); // Enable/disable link previews

// Send the message
$result = $apiInstance->sendMessageText($sender_text);
print_r($result);
```

### Sending Images with Captions

[](#sending-images-with-captions)

```
// Create image message object
$sender_image = new \OpenAPI\Client\Model\SenderImage();
$sender_image->setTo('13016789891');   // Recipient's number
$sender_image->setCaption('Image caption');
$sender_image->setMedia('https://example.com/image.jpg');

// Send the image
$result = $apiInstance->sendMessageImage($sender_image);
print_r($result);
```

### Retrieving Messages

[](#retrieving-messages)

We strongly encourage you to get up-to-date information by using a webhook. A webhook is a tool that allows one app to send real-time data to another app.

[This guide](https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url) describes where to find this link, recommended server options, and popular solutions.

#### Get Multiple Messages

[](#get-multiple-messages)

```
// Parameters
$count = 100;  // Number of messages to retrieve
$offset = 0;   // Pagination offset

// Get messages
$result = $apiInstance->getMessages($count, $offset);
print_r($result);
```

#### Get Single Message

[](#get-single-message)

```
// Get message by ID
$message_id = "your_message_id";
$result = $apiInstance->getMessage($message_id);
print_r($result);
```

Groups API
----------

[](#groups-api)

### Creating Groups

[](#creating-groups)

First, initialize the Groups API client:

```
$apiInstance = new OpenAPI\Client\Api\GroupsApi(
    new GuzzleHttp\Client(),
    $config
);

// Create group request
$create_group_request = [
    "subject" => "Group Name",
    "participants" => [
        "13016789891",
        "13016789892"
    ]
];

// Create the group
$result = $apiInstance->createGroup($create_group_request);
print_r($result);
```

Important Notes
---------------

[](#important-notes)

1. Phone Numbers:

    - Always include country code (e.g., '13016789891' for US number)
    - Don't use special characters or spaces
2. Media URLs:

    - Must be publicly accessible
    - Support common image formats (JPEG, PNG, etc.)
3. Message Options:

    - Ephemeral: Time in seconds before message disappears
    - ViewOnce: Message can only be viewed once
    - TypingTime: Simulates natural typing delay

Error Handling
--------------

[](#error-handling)

It's recommended to implement try-catch blocks:

```
try {
    $result = $apiInstance->sendMessageText($sender_text);
    print_r($result);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

Rate Limits and Best Practices
------------------------------

[](#rate-limits-and-best-practices)

1. Avoid sending too many messages in quick succession
2. Implement proper error handling
3. Store and handle message IDs for tracking
4. Regular monitoring of API responses
5. Maintain proper logging for debugging

Support
-------

[](#support)

For additional support or questions:

- For more information, please visit [Whapi.Cloud Support](https://whapi.cloud/support).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance46

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity13

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/143504978?v=4)[WhatsApp API for developers](/maintainers/Whapi-Cloud)[@Whapi-Cloud](https://github.com/Whapi-Cloud)

---

Top Contributors

[![Whapi-Cloud](https://avatars.githubusercontent.com/u/143504978?v=4)](https://github.com/Whapi-Cloud "Whapi-Cloud (4 commits)")

---

Tags

apiapi-clientapi-gatewayapi-restapi-sdkcloud-apicloud-api-sdkphpphp-sdkwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-sdkwhatsappbot

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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