Download the PHP package devsfort/laravel-whatsapp-chat without Composer

On this page you can find all versions of the php package devsfort/laravel-whatsapp-chat. 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-chat

Laravel WhatsApp Chat Package

A comprehensive WhatsApp integration package for Laravel with support for Meta WhatsApp Business API and WhatsAppJS Client, featuring real-time chat functionality, OTP verification, notifications, and attachment handling.

Features

⚠️ Important: WhatsApp Client Gateway

For WhatsAppJS Client mode: This package includes the Node.js gateway service in the whatsapp-client-gateway directory. You must set it up and run it before testing Client mode. See the Gateway Setup section below.

For Meta Business API mode: No additional services required - just configure your API credentials.

Installation

1. Install via Composer

2. Run the Installation Command

The installation command will:

3. Configure Your Environment

For Meta WhatsApp Business API (Default)

Add your WhatsApp Business API credentials to .env:

For WhatsAppJS Client

Add your WhatsApp Client configuration to .env:

Note: For WhatsAppJS Client mode, you'll need to run the Node.js gateway service separately. See the WhatsAppJS Client Setup section.

4. Update Your User Model

Add the required fields to your users table migration:

Add to your User model's $fillable array:

5. Run Migrations

Configuration

The package configuration is published to config/whatsapp-chat.php. Key settings:

Provider Modes

Meta WhatsApp Business API (business)

The default mode uses Meta's official WhatsApp Business Cloud API.

Features:

Setup:

  1. Create a Meta Business account
  2. Set up WhatsApp Business API
  3. Get access token and phone number ID
  4. Configure webhook URL
  5. Set WHATSAPP_MODE=business in .env

WhatsAppJS Client (client)

Uses WhatsApp Web via a Node.js gateway service.

Features:

Setup:

  1. Install and run the Node.js gateway (see below)
  2. Configure gateway URL and token
  3. Set WHATSAPP_MODE=client in .env
  4. Scan QR code to authenticate

WhatsAppJS Client Setup

Gateway Included in Package

The WhatsAppJS Client gateway is included in this package in the whatsapp-client-gateway directory. You need to set it up and run it before testing Client mode.

Step 1: Navigate to Gateway Directory

The gateway is included in the package. Navigate to it:

Step 2: Install Dependencies

If you have the gateway code, follow these steps:

1. Install Dependencies

2. Configure Gateway

Copy .env.example to .env:

Important: The WHATSAPP_CLIENT_TOKEN and LARAVEL_WEBHOOK_SECRET must match the values in your Laravel .env file:

3. Run Gateway

4. Authenticate

  1. Ensure gateway is running on port 3000 (or configured port)
  2. Access the admin settings page: /admin/whatsapp-settings/{masterKey}
  3. Click "Get QR Code" or "Restart & New QR"
  4. Scan the QR code with your WhatsApp
  5. Wait for connection confirmation

Gateway Requirements

The gateway service must provide these endpoints:

All endpoints (except /health) require Bearer token authentication.

Gateway Webhooks

The gateway sends webhooks to Laravel at:

All webhooks include HMAC signature in X-WhatsApp-Webhook-Signature header.

Usage

Sending Messages

Using Provider Directly

Notifications

The package integrates with Laravel's notification system:

Create your notification class using the provided stubs:

Then implement the toWhatsApp() method:

API Endpoints

Chat Routes

Verification Routes

Settings Routes (Admin, Master Key Protected)

Webhook Routes

Client Webhook Routes (API)

Webhook Setup

Meta API Webhook

  1. Set your webhook URL to: https://yourdomain.com/webhook/whatsapp
  2. Use the verify token from your configuration
  3. Subscribe to messages, message_deliveries, message_reads events

Client Webhook

The client webhook uses HMAC signature verification. Make sure:

  1. WHATSAPP_CLIENT_WEBHOOK_SECRET matches in both Laravel and gateway
  2. Gateway sends X-WhatsApp-Webhook-Signature header
  3. Webhook URL is: https://yourdomain.com/api/whatsapp/client/incoming

Broadcasting Setup

The package uses Laravel Broadcasting for real-time features. Configure your broadcasting driver in .env:

Console Commands

Customization

User Model Configuration

If your User model uses different field names, configure them:

Notification Classes

Configure custom notification classes:

Troubleshooting

Common Issues

  1. "Provider not found"

    • Ensure WHATSAPP_MODE is set correctly in .env
    • Check that provider classes are autoloaded
    • Run composer dump-autoload
  2. "Client connection failed"

    • Verify gateway is running on configured port
    • Check WHATSAPP_CLIENT_TOKEN matches in both services
    • Review gateway logs for errors
  3. "Messages not appearing in real-time"

    • Check your broadcasting configuration
    • Ensure Pusher is properly configured
    • Check browser console for JavaScript errors
  4. "WhatsApp messages not sending"

    • Verify your API credentials (business mode)
    • Check if you're in mock mode
    • Review the logs for API errors
    • For client mode, ensure gateway is connected
  5. "QR code not showing"
    • Only available in client mode
    • Check gateway connection status
    • Try restarting the client via settings page

Debug Mode

Enable debug mode in your configuration:

Migration from Old Implementation

If you're upgrading from an older version:

  1. Update your .env with new configuration options
  2. Run php artisan config:clear
  3. Update your routes to include new endpoints
  4. Review breaking changes in CHANGELOG.md

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This package is open-sourced software licensed under the MIT license.

Support

For support, please open an issue on GitHub or contact us at [email protected].

Changelog

v3.0.0

v2.0.0

v1.0.0


All versions of laravel-whatsapp-chat with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/support Version *
illuminate/database Version *
illuminate/http Version *
illuminate/broadcasting Version *
illuminate/console Version *
illuminate/events Version *
illuminate/queue Version *
pusher/pusher-php-server Version *
guzzlehttp/guzzle Version *
inertiajs/inertia-laravel Version *
tightenco/ziggy Version *
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 devsfort/laravel-whatsapp-chat contains the following files

Loading the files please wait ...