PHP code example of softbread / yii2-sendcloud

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

    

softbread / yii2-sendcloud example snippets

 php
return [
    //....
    'components' => [
        'mailer' => [
            'class' => 'SendCloud\Mail\Mailer',
            'api_user' => '<your sendcloud api-user>',
            'api_key'  => '<your sendcloud api-key>'
        ],
        'sendSms' => [
            'class'  => 'SendCloud\Sms\SendSms',
            'apiUser => '<your SMS api-user>',
            'apiKey  => '<your SMS api-key>'
        ],
    ],
];
 php
Yii::$app->mailer->compose('contact/html')
     ->setFrom('[email protected]')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->send();
 php
Yii::$app->sendSms->setTo(['13700000000', '13011111111'])
    ->setTemplate('1001')
    ->setVars(['code' => '000111'])
    ->send();