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

ActiveLibrary[API Development](/categories/api)

tawhub/laravel-sdk
==================

Laravel package for TawHub WhatsApp API

1.0.0(1mo ago)016↓100%MITPHPPHP ^8.1

Since Apr 11Pushed 1mo agoCompare

[ Source](https://github.com/essamalagamy1/tawhub-laravel)[ Packagist](https://packagist.org/packages/tawhub/laravel-sdk)[ RSS](/packages/tawhub-laravel-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

TawHub Laravel SDK
==================

[](#tawhub-laravel-sdk)

Laravel package to send WhatsApp messages through TawHub API.

Features
--------

[](#features)

- Send plain text messages
- Send text messages with file URL
- Send template messages with dynamic variables
- Works via Facade or Dependency Injection
- Input validation for phone number and file extension
- Configurable retries/backoff and request logging

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

[](#installation)

```
composer require tawhub/laravel-sdk
```

Publish package config:

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

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

[](#configuration)

Set values in `.env`:

```
TAWHUB_BASE_URL=https://tawhub.com/api/create-message
TAWHUB_APP_KEY=your_app_key
TAWHUB_AUTH_KEY=your_auth_key
TAWHUB_SANDBOX=false
TAWHUB_TIMEOUT=30
TAWHUB_RETRY_TIMES=2
TAWHUB_RETRY_SLEEP_MS=250
TAWHUB_RETRY_BACKOFF=fixed
TAWHUB_LOGGING_ENABLED=false
TAWHUB_LOG_CHANNEL=stack
TAWHUB_LOG_INCLUDE_PAYLOAD=false
```

Config file: `config/tawhub.php`

### Retry and Logging

[](#retry-and-logging)

- `TAWHUB_RETRY_TIMES`: number of retries after first failed attempt.
- `TAWHUB_RETRY_SLEEP_MS`: delay in milliseconds before retry.
- `TAWHUB_RETRY_BACKOFF`: `fixed` or `exponential`.
- `TAWHUB_LOGGING_ENABLED`: enable request lifecycle logs.
- `TAWHUB_LOG_CHANNEL`: log channel name from Laravel logging config.
- `TAWHUB_LOG_INCLUDE_PAYLOAD`: include masked payload in logs.

Usage
-----

[](#usage)

### 1) Text Message

[](#1-text-message)

```
use Tawhub\Laravel\Facades\Tawhub;

$response = Tawhub::send_text('201001112223', 'Welcome from Laravel');
```

### 2) Text Message + File

[](#2-text-message--file)

```
$response = Tawhub::send_text_with_file(
    '201001112223',
    'Invoice attached',
    'https://example.com/invoice.pdf'
);
```

### 3) Template Message

[](#3-template-message)

```
$response = Tawhub::send_template('201001112223', 'WELCOME_01', [
    'name' => 'Essam',
    'order_id' => '5566',
]);
```

### 4) Dependency Injection (recommended)

[](#4-dependency-injection-recommended)

```
use Tawhub\Laravel\Contracts\TawhubClientInterface;

public function send(TawhubClientInterface $tawhub): void
{
    $tawhub->send_text('201001112223', 'Hello!');
}
```

API Response Example
--------------------

[](#api-response-example)

```
{
  "message_status": "Success",
  "data": {
    "from": "SENDER_NUMBER",
    "to": "RECEIVER_NUMBER",
    "status_code": 200
  }
}
```

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

[](#error-handling)

The package throws:

- `Tawhub\\Laravel\\Exceptions\\InvalidPayloadException`
- `Tawhub\\Laravel\\Exceptions\\RequestFailedException`

Example:

```
try {
    $response = Tawhub::send_text('201001112223', 'Hello');
} catch (\Tawhub\Laravel\Exceptions\TawhubException $exception) {
    report($exception);
}
```

Testing
-------

[](#testing)

```
composer install
composer test
```

Laravel App Integration Example
-------------------------------

[](#laravel-app-integration-example)

Ready-to-copy sample is available in `examples/laravel-integration/`:

- `examples/laravel-integration/app/Http/Controllers/TawhubDemoController.php`
- `examples/laravel-integration/app/Jobs/SendTawhubMessageJob.php`
- `examples/laravel-integration/routes/web.php`

The flow validates request input in the controller, dispatches a queue job, then sends text/template/file message based on payload.

Release
-------

[](#release)

- Current release: `v1.0.0`
- Changelog: `CHANGELOG.md`

Notes
-----

[](#notes)

- `to` must be full WhatsApp number with country code, digits only.
- Allowed file extensions: `jpg`, `jpeg`, `png`, `webp`, `pdf`, `docx`, `xlsx`, `csv`, `txt`.
- `sandbox` is sent as `true` or `false` string to match TawHub API examples.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90125e57ecc3d4295f10058f1605c2c4b34fa478835229d41a4d9e7f0a2ce6b4?d=identicon)[essamalagamy1](/maintainers/essamalagamy1)

---

Top Contributors

[![essamalagamy1](https://avatars.githubusercontent.com/u/78160551?v=4)](https://github.com/essamalagamy1 "essamalagamy1 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[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)[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)

PHPackages © 2026

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