mkohei / laravel-google-sheets-notification-channel
Google Sheets Notification Channel for Laravel
Installs: 14 924
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
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
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