laravel-google-sheets-notification-channel maintained by mkohei
Description
Google Sheets Notification Channel for Laravel
Author
Last update
2022/03/31 08:52
(dev-main)
License
Downloads
15 981
Google Sheets notifications channel for Laravel
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