sevenspan/laravel-value-first
最新稳定版本:v3.3
Composer 安装命令:
composer require sevenspan/laravel-value-first
包简介
It uses ValueFirst API to send whatsapp messages.
README 文档
README
It uses ValueFirst API to send whatsapp messages.
Installation
You can install the package via composer:
composer require sevenspan/laravel-value-first
You can publish the config file with:
php artisan vendor:publish --provider="SevenSpan\ValueFirst\Providers\ValueFirstServiceProvider" --tag="config"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | ValueFirst Whatsapp API URI |-------------------------------------------------------------------------- | | The ValueFirst Whatsapp Message API URI. | */ 'api_uri' => env('VALUEFIRST_API_URI',''), /* |-------------------------------------------------------------------------- | From Number |-------------------------------------------------------------------------- | | The Phone number registered with ValueFirst that your SMS will come from | */ 'from' => env('VALUEFIRST_FROM',''), /* |-------------------------------------------------------------------------- | Username |-------------------------------------------------------------------------- | | Your ValueFirst Username | */ 'username' => env('VALUEFIRST_USERNAME',''), /* |-------------------------------------------------------------------------- | Password |-------------------------------------------------------------------------- | | Your ValueFirst Password | */ 'password' => env('VALUEFIRST_PASSWORD',''), ];
Usage
For sending whatsapp text messages
use ValueFirst; $to ='9111111111'; // Phone number with country code where we want to send message(Required) $message ='Hello'; // Message that we want to send(Required) $tag = 'Whatsapp Message'; //Tag if you want to assign (Optional) // Without passing tag $response=ValueFirst::sendMessage($to,$message); // With passing tag $response=ValueFirst::sendMessage($to,$message,$tag);
For sending whatsApp text messages using template ID
use ValueFirst; $to ='9111111111'; // Phone number with country code where we want to send message(Required) $templateId = "123"; //Approved template ID by ValueFirst $data = []; // Array of data to replace template data with dynamic one $tag = 'Whatsapp Message'; //Tag if you want to assign (Optional) // Without passing tag $response=ValueFirst::sendTemplateMessage($to,$templateId,$data); // With passing tag $response=ValueFirst::sendTemplateMessage($to,$templateId,$data,$tag);
Note : While sending whatsapp message with template ID, array of data should be in sequence of template dynamic value.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-21