承接 masrur447/twilio-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

masrur447/twilio-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require masrur447/twilio-sdk

包简介

Laravel integration for Twilio SDK

README 文档

README

A simple Laravel package that provides an elegant wrapper for sending SMS using the Twilio API.

Developed by Masrur

🚀 Features

  • Easy Twilio integration in Laravel
  • Simple API to send SMS
  • Configuration via .env file

🧱 Requirements

  • PHP 8.2 or higher
  • Laravel 12x
  • Twilio Account & Credentials

📦 Installation

Install the package via Composer:

composer require masrur447/twilio-sdk

⚙️ Configuration

Step 1: Publish the config file

php artisan vendor:publish --tag=twilio-config

This will publish the config file to:

config/twilio.php

Step 2: Add your credentials in .env

TWILIO_SID=your_twilio_account_sid
TWILIO_TOKEN=your_twilio_auth_token
TWILIO_SENDER_NUMBER=your_twilio_whatsapp_sender_number
TWILIO_SMS_NUMBER=your_twilio_sms_sender_number

Step 3: Example of config/twilio-sdk.php

return [
    'account_sid' => env('TWILIO_SID', ''),
    'auth_token' => env('TWILIO_TOKEN', ''),
    'wp_sender' => env('TWILIO_SENDER_NUMBER', ''),
    'sms_sender' => env('TWILIO_SMS_NUMBER', ''),
];

📤 Usage

✅ Send Whatsapp Message

use Masrur447\TwilioSdk\Twilio;

Twilio::sendWP('+8801234567890', 'Hello from Laravel Twilio SDK!', 'media url or null');

✅ Send SMS

use Masrur447\TwilioSdk\Twilio;

Twilio::sendSMS('+8801234567890', 'Hello from Laravel Twilio SDK!');

🧪 Easy way to use it just add trait in user model

use InteractsWithTwilio;

$user = User::find(1);
$user->notifyTwilioWhatsapp('Hellow from Laravel trait Twilio SDK', 'media url or null');
$user->notifyTwilioSMS('Hellow from Laravel trait Twilio SDK');

🧪 Example: Sending SMS from Controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Masrur447\TwilioSdk\Twilio;

class SmsController extends Controller
{
    public function send(Request $request)
    {
        Twilio::sendSMS($request->phone, $request->message);

        return response()->json([
            'status' => 'SMS sent successfully!',
        ]);
    }
}

🧪 Example: Tinker Usage

php artisan tinker
>>> Twilio::sendSMS('+8801234567890', 'Test SMS from tinker');

🛠 Advanced Usage (Optional)

Coming soon...

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check issues page if you want to contribute.

🧾 License

This project is open-sourced under the MIT license.
See the LICENSE file for more information.

🙌 Author

MasrurGitHub

🌟 Show your support

If you like this package, give it a ⭐ on the GitHub repo!

统计信息

  • 总下载量: 53
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-27