noetikosgroup/yii2-smsbat

Yii2 smsbat

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

0.4 2021-03-31 09:25 UTC

This package is auto-updated.

Last update: 2024-02-29 03:43:42 UTC


README

Yii2 sends SMS from smsbat.com via HTTP protocol

Requirements

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist noetikosgroup/yii2-smsbat "*"

or add

"noetikosgroup/yii2-smsbat": "*"

to the require section of your composer.json file.

Subsequently, run

./yii migrate/up --migrationPath=@vendor/noetikosgroup/yii2-smsbat/migrations

Basic setup

You should:

  • registered account at https://smsbat.com/
  • create login, password and alpha name for usage in SmsBat API

Configuration

Add the following code in your config file ('components' section):

<?php
...
    'components' => [
        'smsbat' => [
            'class' => 'noetikosgroup\smsbat\SmsBat',
            'login' => 'your_login',
            'password' => 'your_password',
            'from' => 'your_name',
        ],
        ...
    ],
...

If you want to save messages in the database - change config:

<?php
...
    'components' => [
        'smsbat' => [
            'class' => 'noetikosgroup\smsbat\SmsBat',
            'login' => 'your_login',
            'password' => 'your_password',
            'from' => 'your_name',
            'saveToDb' => true,
        ],
        ...
    ],
...

Usage

Once the extension is installed, simply use it in your code by :

 <?php Yii::$app->smsbat->send('+380XXXXXXXXX', 'test'); ?>

License

yii2-smsbat is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.