notification-custom-line-channel / line-bot
Line Messaging API Notification Service notification channel for Laravel.
v1.0.0
2025-01-09 14:22 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.9
- illuminate/notifications: ~10.0 || ~11.0
- illuminate/support: ~10.0 || ~11.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^10.5
README
このパッケージは、Laravelを使用して Line Messaging API を利用したプッシュメッセージ送信を簡単にできるようにします。 将来的には、よりMessaging APIを活用した機能が追加される可能性があります。
インストール
このパッケージは Composer を使用してインストールできます:
composer require notification-custom-line-channel/line-bot --update-with-dependencies
セットアップ
Line Messaging APIのチャネルアクセストークンを追加してください config/services.php
:
<?php return [ // ... 'line-bot' => [ 'channel_access_token' => env('LINE_CHANNEL_ACCESS_TOKEN'), ], ];
使用方法
通知内の via() メソッドでこのチャンネルを使用できます。 以下はサンプルコードになります:
<?php namespace App\Http\Controllers; use App\Models\User; use NotificationChannels\Line\LineChannel; use NotificationChannels\Line\LineMessage; use Illuminate\Notifications\Notification; /** * Sample Code. */ class TestController extends Controller { public function notifyToUser() { $user = new User(); $user->notify(new LineNotification()); } } class LineNotification extends Notification { public function via($notifiable) { return [LineChannel::class]; } public function toLine($notifiable) { return LineMessage::create( 'line_user_id', 'Hello world.' ); } }
テスト
$ composer test
Security
セキュリティに関する問題を発見した場合、Issue トラッカーを使用せずに contact@eslo.jp にメールでご連絡ください。
ライセンス
詳細については License File をご覧ください。