uaizap / sdk
PHP SDK for uazapiGO
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/uaizap/sdk
Requires
- guzzlehttp/guzzle: ^7.10
Requires (Dev)
- phpunit/phpunit: ^9.5
README
PHP SDK for the uazapiGO WhatsApp API.
Installation
Install the SDK using Composer:
composer require uaizap/sdk
Usage
Instantiation
To create a new client, you need to provide your API token:
require_once 'vendor/autoload.php'; $client = new Uaizap\Sdk\UaizapClient('YOUR_INSTANCE_TOKEN');
To use the administrative endpoints, you need to create a client with your admin token:
$adminClient = Uaizap\Sdk\UaizapClient::createWithAdminToken('YOUR_ADMIN_TOKEN');
Instances
Create an instance
$instance = $adminClient->initInstance('my-new-instance'); $client->setToken($instance['token']);
List all instances
$instances = $adminClient->listAllInstances();
Connect an instance
$client->connectInstance();
Get instance status
$status = $client->status();
Delete an instance
$adminClient->delete('INSTANCE_ID');
Logout an instance
$client->logout();
Sending Messages
Send a text message
$client->sendText('5511999999999', 'Hello, world!');
Send an image
$client->sendImage('5511999999999', '/path/to/your/image.jpg');
Send a video
$client->sendVideo('5511999999999', '/path/to/your/video.mp4');
Send an audio
$client->sendAudio('5511999999999', '/path/to/your/audio.mp3');
Send a document
$client->sendDocument('5511999999999', '/path/to/your/document.pdf');
Testing
To run the tests, you will need to have PHPUnit installed. You can install it using Composer:
composer require --dev phpunit/phpunit
Then, to run the tests, execute the following command:
./vendor/bin/phpunit