bayurifkialghifari/waxum-php-client

Laravel PHP client for the Waxum WhatsApp API gateway

Maintainers

Package info

github.com/bayurifkialghifari/waxum-php-client

pkg:composer/bayurifkialghifari/waxum-php-client

Transparency log

Statistics

Installs: 58

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.3 2026-07-22 14:17 UTC

This package is auto-updated.

Last update: 2026-07-22 14:18:23 UTC


README

Latest Version on Packagist Tests Total Downloads

A Laravel PHP client library for the Waxum WhatsApp API Gateway. Provides a clean, modular interface to interact with WhatsApp through your Waxum server instance.

Features

  • 🏗️ Modular Architecture — Organized by functionality: session, message, group, contacts, blast, calls, chatstate, media, newsletter, nats, scheduler, presence, privacy, status, blocking, operations, mex, webhook
  • 📦 PHP DTOs — Strongly typed Data Transfer Objects for requests and responses across all endpoints
  • 🔗 Laravel Integration — Service provider, facade (WaxumApi), and config file included
  • ⚙️ Configurable — Set base_url and token via .env or config file

Requirements

  • PHP >= 8.2
  • Laravel / illuminate/support >= 12.0

Installation

composer require bayurifkialghifari/waxum-php-client

Publish the config file:

php artisan vendor:publish --tag="waxum-config"

Configuration

Add to your .env:

WAXUM_BASE_URL=http://localhost:3451
WAXUM_TOKEN=your-bearer-token

Published config (config/waxum.php):

return [
    'base_url' => env('WAXUM_BASE_URL', 'http://localhost:3451'),
    'token'    => env('WAXUM_TOKEN'),
];

Quick Start

Using DTO Objects (Recommended)

use Bayurifkialghifari\WaxumApi\Facades\WaxumApi;
use Bayurifkialghifari\WaxumApi\DTOs\Session\CreateSessionRequest;
use Bayurifkialghifari\WaxumApi\DTOs\Common\SendTextRequest;

// Create a WhatsApp session using DTO
$session = WaxumApi::session()->create(new CreateSessionRequest(
    name: 'Support Session',
));
echo $session->id;

// Send a text message using DTO
$response = WaxumApi::message()->sendText('session-id-123', new SendTextRequest(
    to: '628123456789@s.whatsapp.net',
    text: 'Hello from Waxum PHP Client! 👋',
));

echo $response->messageId; // Typed property from SendResponse DTO

Using Associative Arrays

// Arrays are also supported for quick calls
$response = WaxumApi::message()->sendText('session-id-123', [
    'to' => '628123456789@s.whatsapp.net',
    'text' => 'Hello from array request!',
]);

API Reference & DTO Usage

📱 Session (WaxumApi::session())

use Bayurifkialghifari\WaxumApi\DTOs\Session\CreateSessionRequest;
use Bayurifkialghifari\WaxumApi\DTOs\Common\ConnectRequest;

// Create session
$session = WaxumApi::session()->create(new CreateSessionRequest(name: 'My Session'));
echo $session->id;

// Connect session
$result = WaxumApi::session()->connect('session-123', new ConnectRequest(subscribe: ['Message']));
echo $result->message;

// Get status
$status = WaxumApi::session()->getStatus('session-123');
echo $status->isLoggedIn; // bool

💬 Messages (WaxumApi::message())

use Bayurifkialghifari\WaxumApi\DTOs\Common\SendTextRequest;
use Bayurifkialghifari\WaxumApi\DTOs\Common\SendImageRequest;

// Send text
$response = WaxumApi::message()->sendText('session-123', new SendTextRequest(
    to: '628123456789@s.whatsapp.net',
    text: 'Hello World!',
));
echo $response->messageId;

// Send image
$imageResponse = WaxumApi::message()->sendImage('session-123', new SendImageRequest(
    to: '628123456789@s.whatsapp.net',
    image: 'https://example.com/image.jpg',
    caption: 'Awesome picture',
));

👥 Groups (WaxumApi::group())

use Bayurifkialghifari\WaxumApi\DTOs\Group\CreateGroupRequest;

// Create group
$group = WaxumApi::group()->create('session-123', new CreateGroupRequest(
    subject: 'Development Team',
    participants: ['628123456789@s.whatsapp.net'],
));

🚀 Blast Jobs (WaxumApi::blast())

use Bayurifkialghifari\WaxumApi\DTOs\Blast\CreateBlastRequest;

// Create blast job
$blast = WaxumApi::blast()->create('session-123', new CreateBlastRequest(
    name: 'Promo Blast',
    recipients: ['628123456789@s.whatsapp.net'],
    message: 'Check out our latest offer!',
));

🌐 Webhooks (WaxumApi::webhook())

use Bayurifkialghifari\WaxumApi\DTOs\Webhook\RegisterWebhookRequest;

// Register webhook
$webhook = WaxumApi::webhook()->register('session-123', new RegisterWebhookRequest(
    url: 'https://example.com/webhook',
    events: ['message', 'presence'],
));

Testing

composer test

Code Formatting

composer format

License

The MIT License (MIT). Please see License File for more information.