webiver/laravel-twilio
Composer 安装命令:
composer require webiver/laravel-twilio
包简介
This is a Laravel package for Twilio
README 文档
README
A laravel package that helps you integrate twilio into your laravel app easily.
Installation
Require the package in the composer file:
"require": {
....
"webiver/laravel-twilio": "dev-master"
},
then run composer install.
Register the provider
Register the package service provider in config/app.php file:
Webiver\LaravelTwilio\LaravelTwilioServiceProvider::class,
Add Environment Variables
Now we have to add three lines in .env file
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_SMS_PHONE_NUMBER=
TWILIO_WHATSAPP_PHONE_NUMBER=
TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are credentails that you can get from your twilio account.
TWILIO_SMS_PHONE_NUMBER refers to the sms phone sender number that will be registered with twillio.
TWILIO_WHATSAPP_PHONE_NUMBER refers to the whatsapp phone sender number that will be registered with twillio.
add these values and run:
php artisan config:clear
Usage
use Webiver\LaravelTwilio\Twilio;
$toPhone = "+20120****"; // You need to complete the number in the international format
$mesaage = "Hello World";
// send sms message
Twilio::sms($toPhone,$mesaage);
// send whatsapp message
Twilio::whatsapp($toPhone,$mesaage);
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-04