PHPackages                             bayurifkialghifari/wuzapi-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. bayurifkialghifari/wuzapi-php-client

ActiveLibrary[API Development](/categories/api)

bayurifkialghifari/wuzapi-php-client
====================================

Laravel PHP client for the WuzAPI WhatsApp API

1.0.2(1mo ago)030↓65%MITPHPPHP ^8.2

Since May 3Pushed 1mo agoCompare

[ Source](https://github.com/bayurifkialghifari/wuzapi-php-client)[ Packagist](https://packagist.org/packages/bayurifkialghifari/wuzapi-php-client)[ Docs](https://github.com/bayurifkialghifari/wuzapi-php-client)[ RSS](/packages/bayurifkialghifari-wuzapi-php-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

WuzAPI PHP Client for Laravel
=============================

[](#wuzapi-php-client-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2d3d0d951e9ceff9446b17cee4ad400af5ce965d07247d347a03648804c41aac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626179757269666b69616c676869666172692f77757a6170692d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bayurifkialghifari/wuzapi-php-client)[![Tests](https://camo.githubusercontent.com/9e69a594a5697cf76f36ce26181b77013554a28b7f4416e383dd90a5b1172594/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626179757269666b69616c676869666172692f77757a6170692d7068702d636c69656e742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/bayurifkialghifari/wuzapi-php-client/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5113e142702c1537d0d904bb6e5daf350f9bc65db5d2e9195f7e8b4579609a8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626179757269666b69616c676869666172692f77757a6170692d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bayurifkialghifari/wuzapi-php-client)

A Laravel PHP client library for the [WuzAPI WhatsApp API](https://github.com/asternic/wuzapi). Provides a clean, modular interface to interact with WhatsApp through your WuzAPI server instance.

Features
--------

[](#features)

- 🏗️ **Modular Architecture** — Organized by functionality: `session`, `chat`, `user`, `group`, `admin`, `webhook`
- 📦 **PHP DTOs** — Fully typed request/response objects for all API endpoints
- 🔗 **Laravel Integration** — Service provider, facade, and config file included
- ⚙️ **Configurable** — Set `base_url` and `token` via `.env` or config

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

[](#requirements)

- PHP &gt;= 8.2
- Laravel / `illuminate/support` &gt;= 12.0

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

[](#installation)

```
composer require bayurifkialghifari/wuzapi-php-client
```

Publish the config file:

```
php artisan vendor:publish --tag="wuzapi-config"
```

Configuration
-------------

[](#configuration)

Add to your `.env`:

```
WUZAPI_BASE_URL=http://localhost:8080
WUZAPI_TOKEN=your-admin-token
```

Published config (`config/wuzapi.php`):

```
return [
    'base_url' => env('WUZAPI_BASE_URL', 'http://localhost:8080'),
    'token'    => env('WUZAPI_TOKEN'),
];
```

Quick Start
-----------

[](#quick-start)

```
use Bayurifkialghifari\WuzApi\Facades\WuzApi;
use Bayurifkialghifari\WuzApi\DTOs\Chat\SendTextRequest;
use Bayurifkialghifari\WuzApi\DTOs\Session\ConnectRequest;

// Connect to WhatsApp
WuzApi::session->connect(new ConnectRequest(
    subscribe: ['Message', 'ReadReceipt'],
));

// Send a text message
$response = WuzApi::chat->sendText(new SendTextRequest(
    phone: '628123456789',
    body: 'Hello from Laravel! 👋',
));

echo $response->id; // message ID
```

Or resolve from the container directly:

```
use Bayurifkialghifari\WuzApi\WuzApiClient;

$client = app(WuzApiClient::class);
$client->chat->sendText(new SendTextRequest(phone: '628xx', body: 'Hi!'));
```

---

API Reference
-------------

[](#api-reference)

### 📱 Session

[](#-session)

```
use Bayurifkialghifari\WuzApi\DTOs\Session\ConnectRequest;

// Connect
WuzApi::session->connect(new ConnectRequest(subscribe: ['Message', 'ReadReceipt']));

// Get status
$status = WuzApi::session->getStatus();
echo $status->connected; // bool
echo $status->jid;       // WhatsApp JID

// QR Code
$qr = WuzApi::session->getQRCode();
echo $qr->qrCode; // base64 QR string

// Pair by phone number
$pair = WuzApi::session->pairPhone('628123456789');
echo $pair->linkingCode; // e.g. "1234-5678"

// Disconnect / Logout
WuzApi::session->disconnect();
WuzApi::session->logout();

// History count
WuzApi::session->setHistoryCount(100); // 0 to disable

// Proxy
WuzApi::session->setProxy('socks5://user:pass@proxy:1080', enable: true);

// HMAC webhook signing
WuzApi::session->configureHmac('your_hmac_key_min_32_characters_long');
WuzApi::session->deleteHmacConfig();
```

### 💬 Chat

[](#-chat)

```
use Bayurifkialghifari\WuzApi\DTOs\Chat\{
    SendTextRequest, SendImageRequest, SendAudioRequest,
    SendVideoRequest, SendDocumentRequest, SendStickerRequest,
    SendLocationRequest, SendContactRequest,
    SendButtonsRequest, ChatButton,
    SendTemplateRequest, TemplateButton,
    SendPollRequest, ReactRequest, MarkReadRequest,
    ListSection, ListItem, DownloadMediaRequest,
};

// Text
WuzApi::chat->sendText(new SendTextRequest(phone: '628xx', body: 'Hello!'));

// Image
WuzApi::chat->sendImage(new SendImageRequest(
    phone: '628xx',
    image: 'data:image/jpeg;base64,/9j/4AAQ...',
    caption: 'Check this out!',
));

// Audio / Video / Document / Sticker
WuzApi::chat->sendAudio(new SendAudioRequest(phone: '628xx', audio: 'data:audio/ogg;base64,...'));
WuzApi::chat->sendVideo(new SendVideoRequest(phone: '628xx', video: 'data:video/mp4;base64,...'));
WuzApi::chat->sendDocument(new SendDocumentRequest(phone: '628xx', document: '...', fileName: 'file.pdf'));
WuzApi::chat->sendSticker(new SendStickerRequest(phone: '628xx', sticker: 'data:image/webp;base64,...'));

// Location & Contact
WuzApi::chat->sendLocation(new SendLocationRequest(phone: '628xx', latitude: -6.2, longitude: 106.8, name: 'Jakarta'));
WuzApi::chat->sendContact(new SendContactRequest(phone: '628xx', name: 'John', vcard: 'BEGIN:VCARD...'));

// Buttons
WuzApi::chat->sendButtons(new SendButtonsRequest(
    phone: '628xx',
    body: 'Choose:',
    buttons: [
        new ChatButton(buttonId: 'yes', displayText: 'Yes'),
        new ChatButton(buttonId: 'no',  displayText: 'No'),
    ],
));

// List
WuzApi::chat->sendList('628xx', 'View Menu', 'Pick one', 'Options', [
    new ListSection('Main', [
        new ListItem('Pizza', 'pizza', 'Delicious'),
        new ListItem('Burger', 'burger'),
    ]),
]);

// Poll (groups only)
WuzApi::chat->sendPoll('120362@g.us', 'Favorite color?', ['Red', 'Blue', 'Green']);

// React
WuzApi::chat->react(new ReactRequest(phone: '628xx', body: '❤️', id: 'msg-id'));

// Mark read
WuzApi::chat->markRead(new MarkReadRequest(ids: ['msg-1', 'msg-2'], chat: '628xx@s.whatsapp.net'));

// Edit / Delete
WuzApi::chat->editMessage('msg-id', '628xx', 'Updated text');
WuzApi::chat->deleteMessage('msg-id');

// Archive
WuzApi::chat->archiveChat('628xx@s.whatsapp.net', archive: true);

// Chat history
$messages = WuzApi::chat->getChatHistory('628xx@s.whatsapp.net', limit: 50);

// Download media
$media = WuzApi::chat->downloadImage(new DownloadMediaRequest(
    url: 'https://mmg.whatsapp.net/...',
    directPath: '/path',
    mediaKey: 'key',
    mimetype: 'image/jpeg',
    fileEncSha256: 'hash',
    fileSha256: 'hash',
    fileLength: 2048,
));
echo $media->data; // base64
```

### 👤 User

[](#-user)

```
// Check if numbers are on WhatsApp
$checks = WuzApi::user->check(['628123456789']);
echo $checks[0]->isInWhatsapp; // bool

// Get user info
$info = WuzApi::user->getInfo(['628123456789']);

// Avatar
$avatar = WuzApi::user->getAvatar('628123456789', preview: true);
echo $avatar->url;

// Contacts
$contacts = WuzApi::user->getContacts();

// Presence
WuzApi::user->sendPresence('available'); // or 'unavailable'

// LID
$lid = WuzApi::user->getLid('628123456789');
echo $lid->lid;
```

### 👥 Group

[](#-group)

```
// List groups
$groups = WuzApi::group->list();

// Create
$group = WuzApi::group->create('My Group', ['628111', '628222']);
echo $group->jid;

// Info
$info = WuzApi::group->getInfo('120362@g.us');

// Participants
WuzApi::group->updateParticipants('120362@g.us', 'add',    ['628333']);
WuzApi::group->updateParticipants('120362@g.us', 'remove', ['628333']);
WuzApi::group->updateParticipants('120362@g.us', 'promote', ['628333']);
WuzApi::group->updateParticipants('120362@g.us', 'demote',  ['628333']);

// Settings
WuzApi::group->setName('120362@g.us', 'New Name');
WuzApi::group->setTopic('120362@g.us', 'New description');
WuzApi::group->setAnnounce('120362@g.us', true);   // only admins can send
WuzApi::group->setLocked('120362@g.us', true);     // only admins can edit info
WuzApi::group->setEphemeral('120362@g.us', '7d');  // '24h' | '7d' | '90d' | 'off'

// Photo
WuzApi::group->setPhoto('120362@g.us', 'data:image/jpeg;base64,...');
WuzApi::group->removePhoto('120362@g.us');

// Invite
$link = WuzApi::group->getInviteLink('120362@g.us');
WuzApi::group->join('https://chat.whatsapp.com/XXXX');
WuzApi::group->leave('120362@g.us');
```

### 🔗 Webhook

[](#-webhook)

```
use Bayurifkialghifari\WuzApi\DTOs\Webhook\WebhookEventType;
use Bayurifkialghifari\WuzApi\Modules\WebhookModule;

// Set webhook
WuzApi::webhook->setWebhook('https://example.com/webhook', [
    WebhookEventType::MESSAGE,
    WebhookEventType::READ_RECEIPT,
    WebhookEventType::CONNECTED,
]);

// Get config
$config = WuzApi::webhook->getWebhook();
echo $config->webhook;   // URL
echo $config->subscribe; // array of subscribed events

// Update
WuzApi::webhook->updateWebhook(
    webhookUrl: 'https://new-url.com/webhook',
    events: [WebhookEventType::MESSAGE],
    active: true,
);

// Delete
WuzApi::webhook->deleteWebhook();

// All available events
$events = WebhookModule::getAvailableEvents(); // array of strings
```

### 👨‍💼 Admin (requires admin token)

[](#‍-admin-requires-admin-token)

```
use Bayurifkialghifari\WuzApi\DTOs\Admin\{CreateUserRequest, UpdateUserRequest};

// List users
$users = WuzApi::admin->listUsers(token: 'admin-token');

// Get user
$user = WuzApi::admin->getUser('user-id', token: 'admin-token');

// Create user
$new = WuzApi::admin->addUser(new CreateUserRequest(
    name: 'John Doe',
    token: 'user-token-123',
    webhook: 'https://example.com/hook',
    events: 'Message,ReadReceipt',
    history: 20,
), token: 'admin-token');

// Update user
WuzApi::admin->updateUser('user-id', new UpdateUserRequest(
    name: 'Updated Name',
    history: 100,
), token: 'admin-token');

// Delete user
WuzApi::admin->deleteUser('user-id', token: 'admin-token');
WuzApi::admin->deleteUserComplete('user-id', token: 'admin-token'); // full deletion
```

---

Per-Request Token Override
--------------------------

[](#per-request-token-override)

Each method accepts an optional `$token` parameter to override the configured token:

```
$client->chat->sendText(new SendTextRequest(phone: '628xx', body: 'Hi'), token: 'other-user-token');
```

---

WebhookEventType Enum
---------------------

[](#webhookeventtype-enum)

All 45 WuzAPI webhook events are available as a PHP backed enum:

```
use Bayurifkialghifari\WuzApi\DTOs\Webhook\WebhookEventType;

WebhookEventType::MESSAGE->value;        // 'Message'
WebhookEventType::CONNECTED->value;      // 'Connected'
WebhookEventType::HISTORY_SYNC->value;   // 'HistorySync'
WebhookEventType::ALL->value;            // 'All'
```

---

Testing
-------

[](#testing)

```
composer test
```

The test suite uses `Http::fake()` — no real WuzAPI server needed.

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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 ~2 days

Total

3

Last Release

32d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4166e5118b410e3315fd869981ef89f01c084951834bce5cd37c6ac59de78080?d=identicon)[bayurifki](/maintainers/bayurifki)

---

Top Contributors

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

---

Tags

whatsappwhatsapp-sdkwuzapilaravelwhatsappwuzapibayurifkialghifari

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bayurifkialghifari-wuzapi-php-client/health.svg)

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

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24740.3k](/packages/harris21-laravel-fuse)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4923.6k5](/packages/ralphjsmit-laravel-glide)

PHPackages © 2026

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