PHPackages                             positus/positus-api-php-client - 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. positus/positus-api-php-client

ActiveLibrary[API Development](/categories/api)

positus/positus-api-php-client
==============================

Client library for Positus APIs

0.1.0(4y ago)43.9k↓50%11MITPHPPHP ^7.3|^8.0

Since Jul 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/positusapps/positus-api-php-client)[ Packagist](https://packagist.org/packages/positus/positus-api-php-client)[ RSS](/packages/positus-positus-api-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (11)Used By (1)

Requirements
------------

[](#requirements)

- PHP 7.3+

Installing
----------

[](#installing)

Use Composer to install it:

```
composer require positus/positus-api-php-client

```

If you use Laravel, we provide a [wrapper](https://github.com/positusapps/positus-api-laravel-client).

Instantiating
-------------

[](#instantiating)

```
use Positus\Client;

$client = new Client();
```

Authentication
--------------

[](#authentication)

If you don't have an authentication token, [click here](https://studio.posit.us/minha-conta/api-tokens) to generate one.

```
$client = new Client();

$client->setToken('you-api-token');
```

Sending Messages
----------------

[](#sending-messages)

The first step to be able to send messages is to specify the ID number of origin:

```
$number = $client->number('your-number-id');
```

Then send the message and wait for a response.

If you want to test a Sandbox you can pass a second argument when calling the number method as `true`:

```
$number = $client->number('sandbox-number-id', true);
```

If you want to send a message using data on your own, you can use:

```
$response = $number->sendData([
    'to' => '+5511999999999',
    'type' => 'text',
    'text' => [
        'body' => 'Hi!'
    ]
]);
```

To check all the data that can be sent in each type of message, check the [WhatsApp Business documentation](https://developers.facebook.com/docs/whatsapp/api/messages).

If you prefer, we provide ready methods for each type of message.

### Text

[](#text)

```
$response = $number->sendText('+5511999999999', 'Your message');
```

### Template

[](#template)

```
$response = $number->sendTemplate('+5511999999999', 'namespace', 'name', 'languageCode', [
    "type" => "body",
    "parameters" => [
        [
            "type" => "text",
            "text" => "Param 1"
        ],
        ...
    ]
]);
```

Please check the documentation related to templates in the [WhatsApp Business documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates).

### Contacts

[](#contacts)

```
$response = $number->sendContacts('+5511999999999', [
    [
        'name' => [
            "formatted_name" => "John Doe"
        ],
        'phones' => [
            'phone' => '+5511888888888',
            'type' => 'CELL'
        ]
    ]
]);
```

Please check the documentation related to contacts in the [WhatsApp Business documentation](https://developers.facebook.com/docs/whatsapp/api/messages/others#contacts).

### Location

[](#location)

```
$response = $number->sendLocation('+5511999999999', '-23.553885', '-46.662819', 'Robbu - Atendimento digital inteligente', 'Av. Angélica, 2530 - Bela Vista, São Paulo - SP, 01228-200');
```

### Image

[](#image)

```
$response = $number->sendImage('+5511999999999', 'https://example.com/image.jpg', 'Random Image');
```

### Document

[](#document)

```
$response = $number->sendDocument('+5511999999999', 'https://example.com/document.pdf', 'Random Document');
```

### Video

[](#video)

```
$response = $number->sendVideo('+5511999999999', 'https://example.com/video.mp4', 'Random Video');
```

### Audio

[](#audio)

```
$response = $number->sendAudio('+5511999999999', 'https://example.com/audio.mp3');
```

Receiving media
---------------

[](#receiving-media)

To download a media, use the following method:

```
$response = $number->getMedia('media-id');
```

Responses
---------

[](#responses)

After any call you can check if everything went well and receive the data using the following methods:

```
if ($response->success()) {
    echo 'Message with Id ' . $response->json()->messages[0]->id . ' sent successfully';
}
```

If everything goes correctly you will receive an answer like this:

```
{
    "messages": [
        {
            "id": "gBEGVUOWQWWQAgnFOaNl67sTDIE"
        }
    ],
    "message": "The message was successfully sent"
}
```

If something goes wrong, you will receive a message detailing the errors:

```
{
    "errors": [
        {
            "code": 1008,
            "title": "Required parameter is missing",
            "details": "Parameter 'body' is mandatory for type 'text'"
        }
    ],
    "message": "Unfortunately we were not able to send your message"
}
```

Please check all possible errors that the api may return in the [WhatsApp Business documentation](https://developers.facebook.com/docs/whatsapp/api/errors).

Feel free to create a [pull request](https://github.com/positusapps/positus-api-php-client) or open a [support ticket](https://studio.posit.us/suporte) in Positus Studio if you have or find any problems.

You can check if it failed:

```
if ($response->error()) {
    echo 'Something went wrong';
}
```

If you only need the status code:

```
$response->status();
```

You can get the answer from api as a string:

```
$response->body();
```

Or if you prefer as JSON:

```
$response->json();
```

Or if you prefer as object:

```
$response->object();
```

You can get a header:

```
$response->header('Content-Type');
```

Or you can get all headers:

```
$response->headers();
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

Every ~40 days

Recently: every ~90 days

Total

10

Last Release

1761d ago

PHP version history (3 changes)0.0.1PHP ^7.4

0.0.6PHP ^7.0

0.1.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a1457fcefe44b5ba7da23c4b86437a0911936dacff1ac26257c841d0a8d1606?d=identicon)[caiokawasaki](/maintainers/caiokawasaki)

---

Top Contributors

[![caiokawasaki](https://avatars.githubusercontent.com/u/9747004?v=4)](https://github.com/caiokawasaki "caiokawasaki (27 commits)")

---

Tags

posituspositus-api-php-client

### Embed Badge

![Health badge](/badges/positus-positus-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/positus-positus-api-php-client/health.svg)](https://phpackages.com/packages/positus-positus-api-php-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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