Download the PHP package jordanmiguel/laravel-whatsapp-wuz without Composer

On this page you can find all versions of the php package jordanmiguel/laravel-whatsapp-wuz. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-whatsapp-wuz

Laravel WhatsApp Wuz

Latest Version on Packagist Total Downloads License Buy me a coffee

A Laravel package for managing WhatsApp devices through WuzAPI. Connect multiple WhatsApp numbers to your application with multi-owner, multi-device support, Laravel notifications, and automatic webhook handling.


Table of Contents

Requirements

Installation

Publish the config and migrations, then run them:

Configuration

Add these variables to your .env file:

Variable Description
WUZ_ENABLED Enable or disable the package globally
WUZ_API_URL URL of your WuzAPI instance
WUZ_ADMIN_TOKEN Admin token for managing devices via the WuzAPI
WUZ_DEFAULT_COUNTRY_CODE Default country code for phone number normalization
WUZ_DEBUG Enable debug mode — redirects or skips all outgoing messages
WUZ_DEBUG_TO Phone number to redirect all messages to (leave empty to log-only)

See config/wuz.php for additional options like custom table names, webhook path, and middleware.

Debug Mode

When WUZ_DEBUG=true, all outgoing messages are intercepted before sending. This lets you test the full pipeline in development/staging without messaging real users.

Quick Start

1. Add the trait and interface to your owner model (any Eloquent model that owns WhatsApp devices):

2. Create a device:

3. Get the QR code and scan it with WhatsApp:

4. Send a message:

Core Concepts

Owners & Devices

Any Eloquent model can own WhatsApp devices by implementing the HasWuzDevices interface. This uses a polymorphic relationship, so a Clinic, Organization, Team, or User model can all own devices independently.

Each owner can have multiple devices. One device per owner is always marked as the default — this is the device used when sending notifications.

Device Lifecycle

  1. Create — Registers a new device with WuzAPI and stores it in your database
  2. Connect — Initiates the connection (happens automatically on create)
  3. Scan QR — Use GetDeviceStatusAction to retrieve the QR code for the user to scan with their WhatsApp mobile app
  4. Connected — Once scanned, the device is connected and ready to send/receive messages
  5. Send/Receive — Send messages via SendMessageAction, receive via webhooks

Usage

Managing Devices

Create a Device

The first device per owner is automatically set as default.

Check Device Status / Get QR Code

Disconnect a Device

Delete a Device

When you delete the default device, the next oldest device is automatically promoted to default.

Sending Messages

Supported message types: text, image, video, document, button.

Notification Channel

Send WhatsApp messages through Laravel's notification system.

Define a Notification

Set Up the Notifiable Model

The notifiable model needs the InteractsWithWuz trait to resolve which device should send the message:

The channel resolves the device by calling resolveWuzOwner() on the notifiable, then uses that owner's default device to send the message.

Configuration — Selective Logging and Event-Driven Messages

config/wuz.php exposes two knobs for the webhook pipeline:

Defaults are conservative. MESSAGE is not logged by default — opt in if you want raw payload rows. Lifecycle, pairing, and error events are logged so you have a forensic trail when things break.

Inbound messages are event-driven. Subscribe to JordanMiguel\Wuz\Events\MessageReceived and persist however your domain needs:

MessageSent fires symmetrically for outbound (HTTP 2xx WUZ responses only).

For media: call WuzService::downloadImage/downloadVideo/downloadDocument from inside a MessageReceived listener. The package no longer auto-downloads.

See UPGRADING.md for the v1→v2 migration guide.

Webhooks & Events

Incoming WhatsApp events are received at POST /api/wuz/webhook/{token} (configurable in config/wuz.php).

Handled Events

Webhook Event What Happens Event Dispatched
Message Parses the payload and dispatches the typed event MessageReceived
Disconnected Updates the device's connected state DeviceDisconnected
LoggedOut Clears the device's JID and marks as disconnected DeviceDisconnected

Logging and WebhookReceived dispatch are gated independently — both default sets are conservative but distinct (notably, MESSAGE dispatches by default but is not logged by default). See the "Configuration — Selective Logging and Event-Driven Messages" section above.

Listening to Events

Register listeners in your EventServiceProvider or use Laravel's event discovery:

Multi-Device Management

Each owner can have multiple WhatsApp devices. The package enforces that exactly one device per owner is the default.

Rule Behavior
Multiple devices per owner Supported via polymorphic relationship
One default per owner Enforced via is_default flag
First device auto-default Handled by StoreDeviceAction
Delete promotes next Handled by DeleteDeviceAction
Explicit switch $owner->setDefaultWuzDevice($device)
Notification routing WuzChannel uses the owner's default device

Facade

Testing

Mock the WuzAPI in your application tests using Laravel's HTTP fakes:

Run the package tests:

License

MIT


All versions of laravel-whatsapp-wuz with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-data Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jordanmiguel/laravel-whatsapp-wuz contains the following files

Loading the files please wait ...