PHPackages                             yuri-kovalev/whatsapp-api-client-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. [HTTP &amp; Networking](/categories/http)
4. /
5. yuri-kovalev/whatsapp-api-client-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

yuri-kovalev/whatsapp-api-client-php
====================================

Green-api.com REST API Client

v0.3.7(2mo ago)0192—0%MITPHPPHP &gt;=7.0

Since Jan 7Pushed 2mo agoCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

whatsapp-api-client-php
=======================

[](#whatsapp-api-client-php)

[![Total Downloads](https://camo.githubusercontent.com/ff9ab573e95a1e7248e97109ed62b88c5308433506e01f60fc5430ca66745af6/68747470733a2f2f706f7365722e707567782e6f72672f677265656e2d6170692f77686174736170702d6170692d636c69656e742d7068702f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/green-api/whatsapp-api-client-php)[![Downloads per month](https://camo.githubusercontent.com/e10f88af4a4deffb0abc362424c4737448df38e9e0079f678632291a9c45c331/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f677265656e2d6170692f77686174736170702d6170692d636c69656e742d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/green-api/whatsapp-api-client-php)[![License](https://camo.githubusercontent.com/25524f6af11190841a6f92c8df1c414285cbf089df2feadb14230c96d872d4f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d7265642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/green-api/whatsapp-api-client-php)

- [Документация на русском языке](README_RUS.md)

PHP library for integration with WhatsApp messenger via API of [green-api.com](https://green-api.com/en/) service. To use the library you have to get a registration token and an account id in the [personal area](https://console.green-api.com). There is a free developer account tariff plan.

API
---

[](#api)

You can find REST API documentation by [url](https://green-api.com/en/docs/api/). The library is a wrapper for REST API, so the documentation at the above url applies to the library as well.

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

[](#installation)

Via [Composer](https://getcomposer.org):

```
composer require green-api/whatsapp-api-client-php
```

Import
------

[](#import)

```
require './vendor/autoload.php';

```

Authorization
-------------

[](#authorization)

To send a message or to execute some other Green-API method, you have to have the WhatsApp account in the phone application to be authorized. To authorize your account please go to the [personal area](https://console.green-api.com) and scan a QR-code using the WhatsApp application.

Running index.php
-----------------

[](#running-indexphp)

```
php -S localhost:8080

```

Examples
--------

[](#examples)

### How to initialize an object

[](#how-to-initialize-an-object)

```
$greenApi = new GreenApiClient( idInstance: ID_INSTANCE, apiTokenInstance: API_TOKEN_INSTANCE );

```

### Sending a text message to a WhatsApp number

[](#sending-a-text-message-to-a-whatsapp-number)

```
$result = $greenApi->sending->sendMessage('11001234567@g.us', 'Message text');

```

Example url: [sendTextMessage.php](https://github.com/green-api/whatsapp-api-client-php/blob/master/examples/sendTextMessage.php)

Please note that keys can be obtained from environment variables:

```
