PHPackages                             043668824/wag-laravel-sdk - 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. 043668824/wag-laravel-sdk

ActiveLibrary[API Development](/categories/api)

043668824/wag-laravel-sdk
=========================

Laravel SDK for WhatsApp API Gateway - A comprehensive package for integrating WhatsApp messaging capabilities into Laravel applications

v1.0.3(11mo ago)0151MITPHPPHP ^8.1CI passing

Since Jun 9Pushed 11mo agoCompare

[ Source](https://github.com/043668824/wag-laravel-sdk)[ Packagist](https://packagist.org/packages/043668824/wag-laravel-sdk)[ Docs](https://github.com/043668824/wag-laravel-sdk)[ RSS](/packages/043668824-wag-laravel-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

WAG Laravel SDK
===============

[](#wag-laravel-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8b368b9ebf50144da00f50a0e9ad0645cd30a9ff2bcaa815a0983b328484849c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f3034333636383832342f7761672d6c61726176656c2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/043668824/wag-laravel-sdk)[![Total Downloads](https://camo.githubusercontent.com/0d941143ad8eca8b70527f3a20d01b6ca0d5c0f903377187695c2659b9b786d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f3034333636383832342f7761672d6c61726176656c2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/043668824/wag-laravel-sdk)[![License](https://camo.githubusercontent.com/cc393c92b3c82c38db561b5e8817c6d0834ac811f99ae6e514e58ff3229b7103/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f3034333636383832342f7761672d6c61726176656c2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/043668824/wag-laravel-sdk)

A comprehensive Laravel SDK for **WUZAPI** - WhatsApp Multi-User API powered by **tulir/whatsmeow**. This package provides a clean, Laravel-friendly interface to interact with WhatsApp Business API features including messaging, media handling, group management, and more.

Features
--------

[](#features)

- 🚀 **Multi-User Support** - Handle multiple WhatsApp accounts
- 💬 **Complete Messaging** - Text, images, documents, audio, video, location
- 👥 **Group Management** - Create, manage participants, settings
- 📞 **Contact Management** - Info, profile pictures, blocking
- 🔗 **Webhook Integration** - Real-time event handling
- 📰 **Newsletter Support** - Manage WhatsApp newsletters
- 🔐 **Secure Authentication** - Dynamic user tokens + admin API keys
- 📱 **Session Management** - QR codes, connection status
- 🛡️ **Error Handling** - Comprehensive exception handling
- 🧪 **Laravel Integration** - Service providers, facades, configuration

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

[](#installation)

Install the package via Composer:

```
composer require 043668824/wag-laravel-sdk
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

The package will automatically register its service provider and facade.

For Laravel &lt; 5.5, manually add to `config/app.php`:

```
'providers' => [
    WAG\LaravelSDK\WAGServiceProvider::class,
],

'aliases' => [
    'WAG' => WAG\LaravelSDK\Facades\WAG::class,
],
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=wag-config
```

Add the following variables to your `.env` file:

```
WUZAPI_BASE_URL=https://your-wuzapi-instance.com
WUZAPI_ADMIN_TOKEN=your-admin-token-here
WUZAPI_TIMEOUT=30
WUZAPI_CONNECT_TIMEOUT=10
WUZAPI_LOGGING=false
WUZAPI_LOG_CHANNEL=stack
```

Basic Usage
-----------

[](#basic-usage)

### Authentication

[](#authentication)

```
// Using the facade (recommended)
use WAG\LaravelSDK\Facades\WAG;

// Set your user token
WAG::setUserToken('your-user-token');

// Or using dependency injection
public function sendMessage(WAGClient $wagClient)
{
    $wagClient->setUserToken('your-user-token');
    // ...
}
```

### Messaging

[](#messaging)

#### Text Messages

[](#text-messages)

```
// Send a simple text message
$response = WAG::chat()->sendSimpleText('5491155553934', 'Hello from WAG SDK!');

// Send a text message with custom ID
$response = WAG::chat()->sendSimpleText('5491155553934', 'Hello with custom ID', 'msg-123456');

// Send a text as reply to previous message
$response = WAG::chat()->sendTextReply(
    '5491155553934',
    'This is a reply',
    'original-message-id',
    'sender-jid'
);
```

#### Rich Media

[](#rich-media)

```
// Send an image from base64
$response = WAG::chat()->sendImageFromBase64('5491155553934', $base64Image, 'Optional caption');

// Send an image from URL
$response = WAG::chat()->sendImageFromUrl('5491155553934', 'https://example.com/image.jpg', 'Image caption');

// Send a document
$response = WAG::chat()->sendDocumentFromBase64(
    '5491155553934',
    $base64Document,
    'document.pdf'
);

// Send an audio message
$response = WAG::chat()->sendAudioFromBase64('5491155553934', $base64Audio);

// Send a video
$response = WAG::chat()->sendVideoFromBase64('5491155553934', $base64Video, 'Video caption');
```

#### Interactive Messages

[](#interactive-messages)

```
// Send a template with quick reply buttons
$buttons = [
    WAG::chat()->createQuickReplyButton('btn1', 'Yes'),
    WAG::chat()->createQuickReplyButton('btn2', 'No'),
    WAG::chat()->createQuickReplyButton('btn3', 'Maybe')
];
$response = WAG::chat()->sendSimpleTemplate('5491155553934', 'Do you like this SDK?', $buttons, 'Footer text');

// Send a list message
$section1 = WAG::chat()->createListSection('Section 1', [
    WAG::chat()->createListRow('row1', 'Option 1', 'Description for option 1'),
    WAG::chat()->createListRow('row2', 'Option 2', 'Description for option 2')
]);
$section2 = WAG::chat()->createListSection('Section 2', [
    WAG::chat()->createListRow('row3', 'Option 3', 'Description for option 3')
]);
$response = WAG::chat()->sendListMessage(
    '5491155553934',
    'Please select an option:',
    [$section1, $section2],
    'Select',
    'Footer text',
    'List Title'
);

// Send location
$response = WAG::chat()->sendLocationCoordinates(
    '5491155553934',
    -34.603722,
    -58.381592,
    'Buenos Aires',
    'Argentina'
);
```

### Group Management

[](#group-management)

```
// Create a group
$response = WAG::group()->createSimple('My Cool Group', ['5491155553934', '5491144442233']);

// Add members to a group
$response = WAG::group()->addParticipants('123456789@g.us', ['5491155553934']);

// Remove members from a group
$response = WAG::group()->removeParticipant('123456789@g.us', '5491155553934');

// Promote member to admin
$response = WAG::group()->promoteParticipant('123456789@g.us', '5491155553934');

// Change group name
$response = WAG::group()->setName('123456789@g.us', 'New Group Name');

// Change group description
$response = WAG::group()->setTopic('123456789@g.us', 'This is a group for testing the WAG SDK');

// Enable disappearing messages (7 days)
$response = WAG::group()->enableDisappearing7d('123456789@g.us');

// Get group information
$groupInfo = WAG::group()->getInfo('123456789@g.us');
```

### User Management (Admin)

[](#user-management-admin)

```
// List all users (requires admin token)
$users = WAG::admin()->listUsers();

// Create a new user
$user = WAG::admin()->createSimpleUser('NewUser', 'https://your-webhook.com/wuzapi');

// Create a user with proxy configuration
$user = WAG::admin()->createUserWithProxy(
    'ProxyUser',
    'https://your-webhook.com/wuzapi',
    'http://your-proxy-server:3128',
    true
);

// Delete a user
$response = WAG::admin()->deleteUser('user-id');

// Delete a user completely (including all data)
$response = WAG::admin()->deleteUserFull('user-id');
```

### Session Management

[](#session-management)

```
// Connect to WhatsApp
$response = WAG::session()->connect();

// Connect with specific event subscriptions
$response = WAG::session()->connectWithEvents(['Message', 'ReadReceipt']);

// Get QR Code for scanning
$qrCode = WAG::session()->getQRCodeData();

// Get pairing code for phone linking
$pairingCode = WAG::session()->getPairingCode();

// Check connection status
$isConnected = WAG::session()->isConnected();
$isLoggedIn = WAG::session()->isLoggedIn();
$isReady = WAG::session()->isReady();

// Wait for connection with timeout
$connected = WAG::session()->waitForConnection(30);
$loggedIn = WAG::session()->waitForLogin(60);

// Disconnect
$response = WAG::session()->disconnect();

// Logout (terminate session)
$response = WAG::session()->logout();
```

### Webhook Management

[](#webhook-management)

```
// Set webhook URL for all events
$response = WAG::webhook()->setForAllEvents('https://your-webhook.com/wuzapi');

// Set webhook for specific events
$response = WAG::webhook()->setWithEvents(
    'https://your-webhook.com/wuzapi',
    ['Message', 'ReadReceipt']
);

// Get current webhook configuration
$config = WAG::webhook()->get();

// Update webhook URL
$response = WAG::webhook()->updateUrl('https://your-new-webhook.com/wuzapi');

// Activate webhook
$response = WAG::webhook()->activate();

// Deactivate webhook
$response = WAG::webhook()->deactivate();

// Delete webhook configuration
$response = WAG::webhook()->delete();
```

Error Handling
--------------

[](#error-handling)

The SDK throws `WAGException` when API calls fail:

```
use WAG\LaravelSDK\Exceptions\WAGException;

try {
    $response = WAG::chat()->sendSimpleText('5491155553934', 'Hello!');
} catch (WAGException $e) {
    $errorMessage = $e->getMessage();
    $statusCode = $e->getCode();
    $responseData = $e->getResponseData();

    // Handle error
    Log::error("WhatsApp API Error: {$errorMessage}", [
        'code' => $statusCode,
        'data' => $responseData
    ]);
}
```

Phone Number Formatting
-----------------------

[](#phone-number-formatting)

The SDK automatically formats phone numbers to meet WhatsApp API requirements:

```
// These all result in the same formatted number
WAG::chat()->sendSimpleText('5491155553934', 'Hello!');
WAG::chat()->sendSimpleText('+5491155553934', 'Hello!');
WAG::chat()->sendSimpleText('549 11 5555 3934', 'Hello!');
```

Available Services
------------------

[](#available-services)

The SDK provides the following services:

- `admin()` - Administrative operations
- `session()` - Session management and connection
- `webhook()` - Webhook configuration
- `chat()` - Messaging operations
- `user()` - User profile operations
- `group()` - Group management
- `newsletter()` - Newsletter operations

Utility Classes
---------------

[](#utility-classes)

The SDK includes helpful utility classes:

- `PhoneFormatter` - Format and validate phone numbers
- `ResponseFormatter` - Extract and process API responses

Security
--------

[](#security)

- Never store WhatsApp tokens in environment variables or in version control
- Use proper database encryption for storing user tokens
- Consider implementing token rotation for enhanced security

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance52

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

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

Total

4

Last Release

337d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01688b186059a3d64db019464ed09b1e706b7b89bd29873a1a46b16c27f794b4?d=identicon)[043668824](/maintainers/043668824)

---

Top Contributors

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

---

Tags

apilaravelsdkmessaginggatewaywebhookwhatsappwhatsmeow

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/043668824-wag-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/043668824-wag-laravel-sdk/health.svg)](https://phpackages.com/packages/043668824-wag-laravel-sdk)
```

###  Alternatives

[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)[missael-anda/laravel-whatsapp

A Whatsapp Business Cloud API wrapper for Laravel.

677.5k](/packages/missael-anda-laravel-whatsapp)[crenspire/laravel-whatsapp

Laravel WhatsApp Business API package

133.0k](/packages/crenspire-laravel-whatsapp)

PHPackages © 2026

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