PHP code example of mocean / yii-mocean

1. Go to this page and download the library: Download mocean/yii-mocean 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/ */

    

mocean / yii-mocean example snippets


'components' => [
    'mocean' => [
        'class' => 'YiiMocean\MoceanServiceProvider',
        'defaults' => 'main',
        'accounts' => [ //define your account here
            'main' => [
                'api_key' => 'mainAccountApiKey',
                'api_secret' => 'mainAccountApiSecret'
            ],
            'secondary' => [ //if you have more then one account
                'api_key' => 'secondaryAccountApiKey',
                'api_secret' => 'secondaryAccountApiSecret'
            ]
        ],
    ],
]

//will be using the account defined in defaults
//see below if you have multiple accounts
Yii::$app->mocean->message()->send([
    'mocean-to' => '60123456789',
    'mocean-from' => 'MOCEAN',
    'mocean-text' => 'Hello World'
])

Yii::$app->mocean->using('secondary')->message()->send(...);
Yii::$app->mocean->using('third')->message()->send(...);