PHPackages                             diecoding/yii2-wablas - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. diecoding/yii2-wablas

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

diecoding/yii2-wablas
=====================

Wablas wrapper for Yii2

v1.0.0(1y ago)025BSD-3-ClausePHPPHP &gt;=7.4.0

Since Jan 14Pushed 1y agoCompare

[ Source](https://github.com/wanforge/yii2-wablas)[ Packagist](https://packagist.org/packages/diecoding/yii2-wablas)[ RSS](/packages/diecoding-yii2-wablas/feed)WikiDiscussions master Synced 1mo ago

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

Yii2 Wablas
===========

[](#yii2-wablas)

This extension is wrapper of Wablas API for [Yii framework 2.0](http://www.yiiframework.com) (requires PHP 7.4+).

[![Latest Stable Version](https://camo.githubusercontent.com/d33be7fab05e6907c765aef91ddaaf6367d80053e3f71ce081595b152ea9cc68/687474703a2f2f706f7365722e707567782e6f72672f646965636f64696e672f796969322d7761626c61732f76)](https://packagist.org/packages/diecoding/yii2-wablas)[![Total Downloads](https://camo.githubusercontent.com/464153507237bda09e7cc37a4eae08b5a470498e8c00936d11abf94098eae5c9/687474703a2f2f706f7365722e707567782e6f72672f646965636f64696e672f796969322d7761626c61732f646f776e6c6f616473)](https://packagist.org/packages/diecoding/yii2-wablas)[![Latest Unstable Version](https://camo.githubusercontent.com/f8fccbe604323d50e006891019675a4fe6a128899f62dd7befbee07b9662296a/687474703a2f2f706f7365722e707567782e6f72672f646965636f64696e672f796969322d7761626c61732f762f756e737461626c65)](https://packagist.org/packages/diecoding/yii2-wablas)[![License](https://camo.githubusercontent.com/3ca8f3dc304520ddfb57899ed3cf20bca1d696f20eba89c83694bbea0c963ec8/687474703a2f2f706f7365722e707567782e6f72672f646965636f64696e672f796969322d7761626c61732f6c6963656e7365)](https://packagist.org/packages/diecoding/yii2-wablas)[![PHP Version Require](https://camo.githubusercontent.com/314930d1998688a10105d61398d34bcf9d0c34df92ef354b5662e7e78865c22d/687474703a2f2f706f7365722e707567782e6f72672f646965636f64696e672f796969322d7761626c61732f726571756972652f706870)](https://packagist.org/packages/diecoding/yii2-wablas)

Table of contents
-----------------

[](#table-of-contents)

- [Yii2 Wablas](#yii2-wablas)
    - [Table of contents](#table-of-contents)
    - [Instalation](#instalation)
    - [Dependencies](#dependencies)
    - [Basic Usage](#basic-usage)
    - [Create Request](#create-request)
    - [Create Response](#create-response)
    - [Custom version](#custom-version)
    - [Send Message Example](#send-message-example)
        - [Step by step usage](#step-by-step-usage)

Instalation
-----------

[](#instalation)

Package is available on [Packagist](https://packagist.org/packages/diecoding/yii2-wablas), you can install it using [Composer](https://getcomposer.org).

```
composer require diecoding/yii2-wablas ^1.0
```

or add to the require section of your `composer.json` file.

```
"diecoding/yii2-wablas": "^1.0"
```

Dependencies
------------

[](#dependencies)

- PHP 7.4+
- [yiisoft/yii2](https://github.com/yiisoft/yii2)
- [yiisoft/yii2-httpclient](https://github.com/yiisoft/yii2-httpclient)

Basic Usage
-----------

[](#basic-usage)

Add `wablas` component to your configuration file

```
'components' => [
    'wablas' => [
        'class'    => \diecoding\yii2\wablas\Wablas::class,
        'endpoint' => 'my-wablas.com/api',                  // Change with your wablas API endpoint
        'token'    => 'my-token',                           // Change with your wablas API token
        'secret'   => 'my-secret',                          // Optional, change with your wablas API secret, you can use token with format `token.secret`
    ],
],
```

Create Request
--------------

[](#create-request)

```
$data = [
    [
        'phone'   => '6281218xxxxxx',
        'message' => 'hello there',
    ]
];

/** @var \diecoding\yii2\wablas\versions\V2 $wablas */
$wablas  = $this->wablas->build('v2');
$request = $wablas->sendMessage($data)->request;

// Print request to string
print_r($request->toString());

// Short command
$request = $this->wablas->build('v2')->sendMessage($data)->request;
```

Create Response
---------------

[](#create-response)

```
$data = [
    [
        'phone'   => '6281218xxxxxx',
        'message' => 'hello there',
    ]
];

/** @var \diecoding\yii2\wablas\versions\V2 $wablas */
$wablas = $this->wablas->build('v2');
$response = $wablas
    ->sendMessage($data)
    ->send()
    ->response;

// Print whether response is OK
print_r($response->isOk);

// Print status code
print_r($response->statusCode);

// Print response data
print_r($response->data);

// Short command
$response = $this->wablas->build('v2')->sendMessage($data)->send()->response;
```

Custom version
--------------

[](#custom-version)

You can create your own version as follows

1. Create custom version

```
class CustomVersion extends BaseObject
{
    public $wablas;

    public function sendMessage(array $data): Wablas
    {
        $this->wablas->setRequest($this->wablas->client->post(['custom/send-message'])->setData($data));
        return $this->wablas;
    }
}
```

2. Register custom version

```
'components' => [
    'wablas' => [
        'class'    => \diecoding\yii2\wablas\Wablas::class,
        'endpoint' => 'my-wablas.com',                      // Change with your endpoint
        'token'    => 'my-token',                           // Change with your wablas token,
        'secret'   => 'my-secret',                          // Optional, change with your wablas API secret, you can use token with format `token.secret`
        'versions' => [
            'custom' => CustomVersion::class,
        ]
    ],
],
```

3. Call the custom version

```
$wablas = $this->wablas->build('custom')->sendMessage($data)->send();
```

Send Message Example
--------------------

[](#send-message-example)

### Step by step usage

[](#step-by-step-usage)

1. Install component

```
composer require diecoding/yii2-wablas ^1.0
```

2. Update your components configuration

```
'components' => [
    // other components here...
    'wablas' => [
        'class'    => \diecoding\yii2\wablas\Wablas::class,
        'endpoint' => 'my-wablas.com/api',
        'token'    => 'my-token',
        'secret'   => 'my-secret',                          // Optional, you can use token with format `token.secret`
    ],
    // ...
],
```

3. Update controller

```
use Yii;
use yii\web\Controller;

class TestController extends Controller
{
    public function actionTest()
    {
        $data = [
            [
                'phone'   => '6281218xxxxxx',
                'message' => 'hello there',
            ]
        ];

        $response = Yii::$app->wablas->build('v2')->sendMessage($data)->send()->response;

        if ($response->isOk) {
            print_r($response); // Do action
        } else {
            print_r($response); // Do action
        }
    }
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance41

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

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

489d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5fa8faeecf1f3d0da2d981ae5e4238e1590a7897b14b890663a0c49ef03e87a?d=identicon)[diecoding](/maintainers/diecoding)

---

Top Contributors

[![wanforge](https://avatars.githubusercontent.com/u/16300077?v=4)](https://github.com/wanforge "wanforge (19 commits)")[![agielks](https://avatars.githubusercontent.com/u/47511429?v=4)](https://github.com/agielks "agielks (5 commits)")

---

Tags

yii2componentyii2-wablaswablas

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/diecoding-yii2-wablas/health.svg)

```
[![Health](https://phpackages.com/badges/diecoding-yii2-wablas/health.svg)](https://phpackages.com/packages/diecoding-yii2-wablas)
```

###  Alternatives

[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)[dlds/yii2-mlm

Yii2 Multi Level Marketing component

183.8k](/packages/dlds-yii2-mlm)

PHPackages © 2026

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