mkohei / laravel-google-sheets-notification-channel
Google Sheets Notification Channel for Laravel
Package info
github.com/mkohei/laravel-google-sheets-notification-channel
pkg:composer/mkohei/laravel-google-sheets-notification-channel
v1.0.0
2022-03-31 06:52 UTC
Requires
- php: ^8.0
Requires (Dev)
- google/apiclient: ^2.12
- guzzlehttp/guzzle: ^7.4
- illuminate/notifications: ^9.5
- mockery/mockery: ^1.5
- pestphp/pest: ^1.21
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package makes it easy to send Google Sheets using the Laravel notification system and the Google Sheets API.
Contents
Installation
You can install the package via composer:
composer require mkohei/laravel-google-sheets-notification-channel
Set your Google App Client ID and Client Secret to config/services.php:
'google' => [ 'sheets' => [ 'client_id' => env('INTEGRATIONS_GOOGLE_SHEETS_CLIENT_ID'), 'client_secret' => env('INTEGRATIONS_GOOGLE_SHEETS_CLIENT_SECRET'), ], ],
Add a service provider to config/app.php:
/* * Package Service Providers... */ Mkohei\LaravelGoogleSheetsNotificationChannel\GoogleSheetsServiceProvider::class,
Usage
Now you can use the channel in your via() method inside the notification:
use Mkohei\LaravelGoogleSheetsNotificationChannel\GoogleSheetsChannel; use Mkohei\LaravelGoogleSheetsNotificationChannel\GoogleSheetsMessage; use Illuminate\Notifications\Notification; class ProjectCreated extends Notification { public function via($notifiable) { return [GoogleSheetsChannel::class]; } public function toGoogleSheets($notifiable) { return TreasureDataMessage::create() ->data(['value1', 'value2']) ->accessToken('your-access-token') ->spreadsheetId('id'); } }
Testing
composer test