hopeofiran / avanak-laravel
This package helps us to use Avanak services.
v1.7.4
2022-11-05 12:01 UTC
Requires
- php: ^5.6|^7.0|^8.0
- ext-soap: *
- laravel/framework: ^5.5|^7.0|^8.0|^9.0
README
This package helps us to use Avanak services.
installation
To install from
composer
use the following command
composer require hopeofiran/avanak-laravel
configuration .env
file
add account information into
.env
file
AVANAK_USERNAME=your_username AVANAK_PASSWORD=your_password
to change default configuration
to access config file and change default configuration use following command
php artisan vendor:publish --provider=hopeofiran\avanak\Providers\AvanakProvider
or you can set config with
config($keys[,$value])
method
$credit = \hopeofiran\avanak\Facades\AvanakFacade::config('username', "{$your_username}") ->config('password', "{$your_password}") ->getCredit();
OR
$credit = \hopeofiran\avanak\Facades\AvanakFacade::config(['username'=>"{$your_username}", 'password' => "{$your_password}"]) ->getCredit();
also you can modify
avanak
server address withbaseUrl($url)
method
$credit = \hopeofiran\avanak\Facades\AvanakFacade::baseUrl("$avanak_new_address") ->getCredit();
How to use this package
CreateCampaign method
to create campaign use createCampaign()
method
$title = 'example title'; $numbers = ['0912×××6789', '0911×××1111']; $maxTryCount = 2; $minuteBetweenTries = 1; $start = now()->addMicros(5); $end = now()->endOfDay(); $messageId = 123456789; $campaign = \hopeofiran\avanak\Facades\AvanakFacade::createCampaign($title, $numbers, $maxTryCount, $minuteBetweenTries, $start, $end, $messageId);
response
{ "CreateCampaignResult": 123456789 }
QuickSend method
to quick send message use
quickSend()
method
$number = '0912×××6789'; $messageId = 123456789; $response = \hopeofiran\avanak\Facades\AvanakFacade::quickSend($number, $messageId);
response
{ "QuickSendResult": 123456789 }