PHPackages                             const-tech/whatsapp-gateway - 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. const-tech/whatsapp-gateway

ActiveLibrary[API Development](/categories/api)

const-tech/whatsapp-gateway
===========================

Reusable WhatsApp Gateway client + self-service subscription flow for Laravel projects (c-wts.com / Ultramsg compatible).

v2.0.0(1mo ago)01MITPHPPHP ^7.3|^8.0CI failing

Since May 6Pushed 1mo agoCompare

[ Source](https://github.com/const-tech/qr-wts)[ Packagist](https://packagist.org/packages/const-tech/whatsapp-gateway)[ RSS](/packages/const-tech-whatsapp-gateway/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

const-tech/whatsapp-gateway
===========================

[](#const-techwhatsapp-gateway)

Reusable Laravel package that provides:

1. A PHP client for the **c-wts.com REST gateway** — drivers, DTOs, exceptions.
2. A self-service **public subscription flow** (Landing → Register → QR → Expired) ready to drop into any Laravel project.
3. An authenticated **Our Services** page auto-registered on every install.
4. Local mirror of subscriptions in `wa_subscriptions` so customers can resume without re-registering.

**Requirements:** Laravel 8–11, PHP 7.3+.

---

1. The two flows
----------------

[](#1-the-two-flows)

### Claim flow (default)

[](#claim-flow-default)

The customer signs up directly on **c-wts.com**, gets back `instance_id` and `access_token`, then pastes them on your registration page. The package verifies the credentials against the live gateway and saves a local row.

### Reseller flow (private API — for c-wts.com resellers only)

[](#reseller-flow-private-api--for-c-wtscom-resellers-only)

If you have a private reseller agreement with c-wts.com, switch the flow:

```
WHATSAPP_GATEWAY_FLOW=reseller
WHATSAPP_GATEWAY_ADMIN_TOKEN=your_reseller_token
WHATSAPP_GATEWAY_REGISTER_ENDPOINT=/api/reseller/register
WHATSAPP_GATEWAY_RESTART_ENDPOINT=/api/instances/{instance}/restart
WHATSAPP_GATEWAY_PACKAGES_ENDPOINT=/api/packages
WHATSAPP_GATEWAY_UPGRADES_ENDPOINT=/api/instances/{instance}/upgrades
```

The customer fills the form, your server calls the private register endpoint, and you get back `{instance_id, access_token}` — no manual paste required.

Default: **claim**.

---

2. Install
----------

[](#2-install)

```
composer require const-tech/whatsapp-gateway
php artisan migrate
```

The service provider and `WhatsappGateway` facade are auto-discovered.

---

3. Configure
------------

[](#3-configure)

Publish the config (optional — defaults work out of the box):

```
php artisan vendor:publish --tag=whatsapp-gateway-config
```

Key `.env` values:

```
# Gateway
WHATSAPP_GATEWAY_DRIVER=cwts
WHATSAPP_GATEWAY_FLOW=claim

# Branding shown in the package views
APP_NAME="My Website"
WHATSAPP_GATEWAY_HOME_URL=https://your-app.test

# Public subscription route prefix  (default: whatsapp)
WHATSAPP_GATEWAY_ROUTE_PREFIX=whatsapp

# Our Services page (default: our-services)
WHATSAPP_GATEWAY_ADMIN_PREFIX=our-services
WHATSAPP_GATEWAY_BACK_ROUTE=front.home
WHATSAPP_GATEWAY_SERVICES_MODEL=App\Models\OurService
```

> `WHATSAPP_GATEWAY_SERVICES_MODEL` — the Eloquent model that supplies the services table rows (needs `name` and `description` columns). If the class does not exist the services table is silently hidden; the rest of the page still renders.

---

4. Routes
---------

[](#4-routes)

All routes are auto-registered. With **Mcamara/LaravelLocalization** installed they're nested under the active locale and pick up localization middleware automatically.

### Public subscription flow

[](#public-subscription-flow)

URLNamePurpose`GET  /whatsapp``whatsapp-gateway.landing`Landing + free package preview`GET  /whatsapp/register``whatsapp-gateway.register.show`Registration form`POST /whatsapp/register``whatsapp-gateway.register`Submit → verify → store`GET  /whatsapp/connect/{token}``whatsapp-gateway.connect`QR + live status polling`GET  /whatsapp/poll/{token}``whatsapp-gateway.poll`JSON: latest QR + status (AJAX)`POST /whatsapp/restart/{token}``whatsapp-gateway.restart`Re-pair session`GET  /whatsapp/expired/{token}``whatsapp-gateway.expired`Upgrade options### Our Services page (authenticated)

[](#our-services-page-authenticated)

URLNameMiddleware`GET /our-services``whatsapp-gateway.admin.index``web`, `auth`The page uses the package's own Bootstrap/WhatsApp layout — no host-app layout needed. To disable it:

```
// config/whatsapp-gateway.php
'admin' => [ 'enabled' => false ],
```

To disable the subscription routes:

```
'routes' => [ 'enabled' => false ],
```

---

5. Programmatic API
-------------------

[](#5-programmatic-api)

```
use ConstTech\WhatsappGateway\Facades\WhatsappGateway;
use ConstTech\WhatsappGateway\DTOs\RegisterPayload;

$payload = new RegisterPayload(
    name: 'My Clinic',
    phone: '0506499275',
    email: 'info@example.com',
    business: 'My Clinic LLC',
    packageId: 'free',
);

// Claim flow — verify pasted credentials and store
$sub = WhatsappGateway::claim($payload, 'instance12345', 'access_token_here');

// Reseller flow — create on c-wts.com on behalf of the customer
$sub = WhatsappGateway::register($payload);

// Session ops
$qr     = WhatsappGateway::qr($sub);
$status = WhatsappGateway::status($sub);
WhatsappGateway::send($sub, '+966501234567', 'Hello');
WhatsappGateway::restart($sub);

// Resume flow by URL token
$sub = WhatsappGateway::findByToken($localToken);
```

---

6. Customizing the views
------------------------

[](#6-customizing-the-views)

```
php artisan vendor:publish --tag=whatsapp-gateway-views
```

Override any of:

- `layout.blade.php` — RTL/LTR aware HTML wrapper
- `landing.blade.php` — promo + free package card
- `register.blade.php` — form (claim or reseller mode auto-detected)
- `qr.blade.php` — QR code + AJAX polling
- `expired.blade.php` — upgrade options
- `services.blade.php` — Our Services page

Branding (app name, logo, home URL) is read from `config/whatsapp-gateway.php#branding`. Set it once per project — no template edits required.

---

7. Drivers
----------

[](#7-drivers)

DriverClassPurpose`cwts``ConstTech\WhatsappGateway\Drivers\CwtsDriver`Real REST gateway`null``ConstTech\WhatsappGateway\Drivers\NullDriver`Tests / local devTo add a custom gateway implement `ConstTech\WhatsappGateway\Contracts\GatewayDriver` and register it under `config('whatsapp-gateway.drivers.')`.

---

8. Public c-wts.com endpoints used
----------------------------------

[](#8-public-c-wtscom-endpoints-used)

Documented at :

MethodPathParamsGET`/api/status``instance_id`, `access_token`GET`/api/qrcode``instance_id`, `access_token`POST`/api/send``instance_id`, `access_token`, `number`, `message`> **Security:** `access_token` is never exposed to the frontend — all calls are proxied server-side.

---

9. Database
-----------

[](#9-database)

```
wa_subscriptions
├── local_token     (uuid — public token used in URLs)
├── name, phone, email, business
├── package_id, instance_id, token, remote_id
├── status, expires_at, dashboard_url
└── meta (json)

```

Customize the table name / connection:

```
'storage' => [
    'table'      => 'wa_subscriptions',
    'connection' => null,
],
```

---

10. Reusing across Laravel projects
-----------------------------------

[](#10-reusing-across-laravel-projects)

```
composer require const-tech/whatsapp-gateway
php artisan migrate
```

Then set the `.env` values listed in section 3. Same code, same config keys, no copy-paste.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance93

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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

2

Last Release

33d ago

Major Versions

v1.0.0 → v2.0.02026-05-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/90ca0f93aabea1fe207d9dbda3feee3660043c46591dce118e8912f50404d953?d=identicon)[const-tech](/maintainers/const-tech)

---

Top Contributors

[![Marwan88nasser](https://avatars.githubusercontent.com/u/91065097?v=4)](https://github.com/Marwan88nasser "Marwan88nasser (2 commits)")[![WaelMz](https://avatars.githubusercontent.com/u/33140498?v=4)](https://github.com/WaelMz "WaelMz (2 commits)")[![const-sa](https://avatars.githubusercontent.com/u/110822656?v=4)](https://github.com/const-sa "const-sa (1 commits)")

### Embed Badge

![Health badge](/badges/const-tech-whatsapp-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/const-tech-whatsapp-gateway/health.svg)](https://phpackages.com/packages/const-tech-whatsapp-gateway)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[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)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)

PHPackages © 2026

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