PHP library for interract with WhatsApp api
Switch branches/tags
Nothing to show
Clone or download
Latest commit 5ac6e91 Jul 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Initial commit Jul 11, 2018
src Some fixes Jul 13, 2018
tests Some fixes Jul 13, 2018
composer.json Initial commit Jul 11, 2018
phpunit.xml.dist Initial commit Jul 11, 2018
readme.md Update readme.md Jul 17, 2018

readme.md

PHP library for WhatsApp api

Latest Version Total Downloads

Lightweight PHP library for interact with WhatsApp api provided by chat-api.com.

Installing

The recommended way to install is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version:

php composer.phar require chatapi/whatsApp

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update library using composer:

composer.phar update

Usage

Create client instance

$client = Client::getInstance([
   'url' => 'your_url',
   'token' => 'your_token'
]);

Send message

$client->sendMessage([
   'phone' => '78005553535',
   'body' => 'Hi there!'
]);

Send file

$data = $client->sendFile([
   'phone' => '78005553535', 
   'body' => 'some_file',      // file in base64
   'filename' => 'sample.jpg'
]);

Create group

$client->createGroup(
   'New chat', ['78005553535'], 'First message'
);

Get list of all incoming messages

$data = $client->getMessages();

Get not sent messages queue

$data = $client->getMessagesQueue();

Clear not sent messages queue

$data = $client->clearMessagesQueue();

Get account status

$data = $client->getStatus();

Get QR-code

$data = $client->getQrCode();

Set webhook

$data = $client->setWebHook('http://<some_url>');

Get webhook

$data = $client->getWebHook();

Reboot application

$data = $client->reboot();

Logout

$data = $client->logout();