PHP code example of unimodern / yii2-twilio

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

    

unimodern / yii2-twilio example snippets


'components' => array(
    ...
    'Yii2Twilio' => array(
        'class' => 'filipajdacic\yiitwilio\YiiTwilio',
        'account_sid' => 'YOUR_TWILIO_ACCOUNT_SID_HERE',
        'auth_key' => 'YOUR_TWILIO_AUTH_KEY_HERE', 
    ),
    ...
);


    $twilioService = Yii::$app->Yii2Twilio->initTwilio();

    try {
        $message = $twilioService->account->messages->create(array(
            "From" => "+12345678901", // From a valid Twilio number
            "To" => "+12345678901",   // Text this number
            "Body" => "Hello from my Yii2 Application!",
        ));
    } catch (\Services_Twilio_RestException $e) {
            echo $e->getMessage();
    }


php composer.phar