PHPackages                             cubesoftware/cube-connect-sdk-php - 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. cubesoftware/cube-connect-sdk-php

ActiveLibrary[API Development](/categories/api)

cubesoftware/cube-connect-sdk-php
=================================

Official Laravel SDK for CubeConnect WhatsApp Business Platform

v1.0.0(2mo ago)01MITPHPPHP ^8.1

Since Feb 27Pushed 2mo agoCompare

[ Source](https://github.com/CubeSoftLabs/cube-connect-sdk-php)[ Packagist](https://packagist.org/packages/cubesoftware/cube-connect-sdk-php)[ Docs](https://docs.cubeconnect.io)[ RSS](/packages/cubesoftware-cube-connect-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

CubeConnect for Laravel
=======================

[](#cubeconnect-for-laravel)

[![Latest Version](https://camo.githubusercontent.com/f52647411cd4b8811a7febcb3fbd7967e49abfcc0aaab041692bd7fe514742b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63756265736f6674776172652f637562652d636f6e6e6563742d73646b2d7068702e737667)](https://packagist.org/packages/cubesoftware/cube-connect-sdk-php)[![License](https://camo.githubusercontent.com/a720a46e120add67e35fdb88a38dfba3217f5880707f86e32b1f1ff0586a45b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f63756265736f6674776172652f637562652d636f6e6e6563742d73646b2d7068702e737667)](https://packagist.org/packages/cubesoftware/cube-connect-sdk-php)[![PHP Version](https://camo.githubusercontent.com/8f1a19a754fa26909f075c9a8dae27425d611abe4f32337051c0019eba978be1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f63756265736f6674776172652f637562652d636f6e6e6563742d73646b2d7068702e737667)](https://packagist.org/packages/cubesoftware/cube-connect-sdk-php)

Official Laravel SDK for the [CubeConnect](https://cubeconnect.io) WhatsApp Business Platform.

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

[](#installation)

Install the package via Composer:

```
composer require cubesoftware/cube-connect-sdk-php
```

The package auto-discovers its service provider and facade. No manual registration required.

### Publish Configuration

[](#publish-configuration)

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

### Environment Variables

[](#environment-variables)

Add your API key to `.env`:

```
CUBECONNECT_API_KEY=your_api_key_here

```

VariableDefaultDescription`CUBECONNECT_API_KEY`—Your API key from the dashboard`CUBECONNECT_URL``https://cubeconnect.io`API base URL`CUBECONNECT_TENANT_ID``null`Tenant ID (multi-tenant only)`CUBECONNECT_TIMEOUT``30`Request timeout in secondsUsage
-----

[](#usage)

### Sending a Text Message

[](#sending-a-text-message)

```
use CubeConnect\Facades\CubeConnect;

$response = CubeConnect::sendText('+966501234567', 'Your order has been confirmed.');

$response->status;               // "queued"
$response->messageLogId;         // 4521
$response->conversationCategory; // "SERVICE"
$response->queued();             // true
```

> **Note:** Text messages require the recipient to have messaged you within the last 24 hours. Outside this window, use a [template message](#sending-a-template-message).

### Sending a Template Message

[](#sending-a-template-message)

```
use CubeConnect\Facades\CubeConnect;

$response = CubeConnect::sendTemplate(
    '+966501234567',
    'order_confirmation',
    ['ORD-1234', '500 SAR']
);

// With explicit language code (default: en_US)
$response = CubeConnect::sendTemplate(
    '+966501234567',
    'order_confirmation',
    ['ORD-1234', '500 SAR'],
    'ar'
);
```

Parameters map to `{{1}}`, `{{2}}`, etc. in the template body. The SDK automatically converts them to the Meta components format. Templates can be sent at any time.

### Health Check

[](#health-check)

```
$health = CubeConnect::health();
// ['status' => 'healthy', 'checks' => [...], 'timestamp' => '...']
```

Dependency Injection
--------------------

[](#dependency-injection)

You may inject the client using the contract or the concrete class:

```
use CubeConnect\Contracts\Messaging;

class OrderController extends Controller
{
    public function shipped(Order $order, Messaging $messaging)
    {
        $messaging->sendTemplate(
            $order->customer_phone,
            'order_shipped',
            [$order->id, $order->tracking_number]
        );
    }
}
```

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

[](#error-handling)

The SDK throws specific exceptions for each error type. All exceptions include an `errorCode` property matching the [unified API error codes](https://docs.cubeconnect.io/api/errors):

```
use CubeConnect\Facades\CubeConnect;
use CubeConnect\Exceptions\AuthenticationException;
use CubeConnect\Exceptions\ValidationException;
use CubeConnect\Exceptions\RateLimitException;
use CubeConnect\Exceptions\NotFoundException;
use CubeConnect\Exceptions\CubeConnectException;

try {
    CubeConnect::sendText('+966501234567', 'Hello!');
} catch (AuthenticationException $e) {
    // 401 — Invalid or missing API key
    // 403 — Insufficient permissions or tenant issues
    $e->errorCode;  // "INVALID_API_KEY", "AUTHENTICATION_REQUIRED",
                     // "API_KEY_NO_TENANT", "TENANT_NOT_FOUND", "FORBIDDEN"
    $e->statusCode; // 401 or 403
} catch (ValidationException $e) {
    // 422 — Invalid request data
    $e->errorCode; // "VALIDATION_ERROR", "NO_ACTIVE_ACCOUNT",
                   // "MISSING_ACCESS_TOKEN", "INVALID_PHONE_NUMBER"
    $e->errors;    // ['phone' => ['The phone field is required.']]
} catch (NotFoundException $e) {
    // 404 — Resource not found
    $e->errorCode; // "NOT_FOUND", "TEMPLATE_NOT_FOUND"
} catch (RateLimitException $e) {
    // 429 — Rate limit or plan limit exceeded
    $e->errorCode; // "RATE_LIMIT_EXCEEDED", "PLAN_LIMIT_REACHED", "SUBSCRIPTION_EXPIRED"
} catch (CubeConnectException $e) {
    // 5xx or network errors
    $e->errorCode;  // "INTERNAL_ERROR", "MESSAGE_SEND_FAILED", "CONNECTION_FAILED"
    $e->statusCode;
}
```

All exceptions extend `CubeConnectException`, so you can catch the base class for generic handling.

Response Object
---------------

[](#response-object)

All message methods return a `MessageResponse` with the following properties:

PropertyTypeDescription`status``string``queued` on success`messageLogId``int`Unique tracking ID`conversationCategory``string``SERVICE`, `MARKETING`, `UTILITY`, or `AUTHENTICATION``cost``float`Message cost```
$response->queued();   // true if status is "queued"
$response->toArray();  // Array representation
```

Architecture
------------

[](#architecture)

The package follows SOLID principles:

- **`Contracts\Messaging`** — Interface for the messaging client. Bind your own implementation if needed.
- **`CubeConnect`** — Default implementation using Laravel's HTTP client.
- **`CubeConnectServiceProvider`** — Deferred provider that only loads when the service is used.
- **`Facades\CubeConnect`** — Static proxy backed by the `Messaging` contract.

Documentation
-------------

[](#documentation)

Full API documentation is available at [docs.cubeconnect.io](https://docs.cubeconnect.io).

License
-------

[](#license)

CubeConnect for Laravel is open-sourced software licensed under the [MIT license](LICENSE).

Copyright © 2026 [Cube Software](https://cubesoftware.io) (CubeSoftLabs). All rights reserved.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance84

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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

80d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2df6a5937c9ce710311dbabd0c0d9467f1e3c64bc052c41ad068e067b4aad33b?d=identicon)[cubesoftware](/maintainers/cubesoftware)

---

Top Contributors

[![fahadapps79](https://avatars.githubusercontent.com/u/121814410?v=4)](https://github.com/fahadapps79 "fahadapps79 (6 commits)")[![CubeSoftLabs](https://avatars.githubusercontent.com/u/264034789?v=4)](https://github.com/CubeSoftLabs "CubeSoftLabs (2 commits)")

---

Tags

cubeconnectcubesoftwarecube-connect-sdk

### Embed Badge

![Health badge](/badges/cubesoftware-cube-connect-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/cubesoftware-cube-connect-sdk-php/health.svg)](https://phpackages.com/packages/cubesoftware-cube-connect-sdk-php)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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