avanak-laravel maintained by hopeofiran
Description
This package helps us to use Avanak services.
Author
Last update
2022/11/05 13:01
(dev-main)
License
Downloads
956
Tags
Laravel Avanak API service
This package helps us to use Avanak services.
installation
To install from
composeruse the following command
composer require hopeofiran/avanak-laravel
configuration .env file
add account information into
.envfile
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
avanakserver 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
}