PHP code example of ruslidev / yii2-wablas

1. Go to this page and download the library: Download ruslidev/yii2-wablas library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ruslidev / yii2-wablas example snippets


    //...
    'waBlast' => [
        'class' => \ruslidev\wablas\WablasClient::className(),
        'wablasEndpoint' => getenv('WABLAS_ENDPOINT'),
        'apiToken' => getenv('WABLAS_API_TOKEN'),
    ],
    //...

    $message = 'Hello...';
    $phone_number = '08xxxxx'
    $result = Yii::$app->waBlast->sendMessage($message,'08xxxxxx');
    if($result instanceof StreamInterface){
        $resultContent = json_decode($result->getContents());
        $message = $resultContent->data->message[0];
    }

    
    $phone_number = '08xxxxx'
    $result = Yii::$app->waBlast->sendImage($imageCaption, $phone_number,$imageUrl ,$secret = false, $priority = false, $type = 'random');
    if($result instanceof StreamInterface){
        $resultContent = json_decode($result->getContents());
    }

    
    $phone_number = '08xxxxx'
    $result = Yii::$app->waBlast->sendDocumentUrl($docUrl, $phone_number = null , $secret = false, $priority = false, $type = 'random');
    if($result instanceof StreamInterface){
        $resultContent = json_decode($result->getContents());
    }


    $phone_number = '08xxxxx'
    $result = Yii::$app->waBlast->sendDocumentFile($file, $phone_number = null, $secret = false, $priority = false, $type = 'random');
    if($result instanceof StreamInterface){
        $resultContent = json_decode($result->getContents());
    }