molnix / laravel-nextcloud-talk-channel
A Laravel notification channel for Nextcloud Talk
Package info
github.com/Molnix-open-source/laravel-nextcloud-talk-channel
pkg:composer/molnix/laravel-nextcloud-talk-channel
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^6.3 || ^7.0
- illuminate/notifications: ^10.0 || ^11.0 || ^12.0 || ^13.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0 || ^13.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^10.6 || ^11.0
- phpunit/phpunit: ^11.0 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package makes it easy to send notifications using NextcloudTalk with Laravel 10.x, 11.x and 12.x.
Contents
Installation
You can install this package via composer:
composer require molnix/laravel-nextcloud-talk-channel
Setting up the NextcloudTalk service
Add your NextcloudTalk config to config/services.php:
// config/services.php ... 'nextcloudtalk' => [ 'url' => env('NEXTCLOUD_URL'), 'username' => env('NEXTCLOUD_USERNAME'), 'password' => env('NEXTCLOUD_PASSWORD'), 'default_channel' => env('NEXTCLOUD_DEFAULT_CHANNEL'), 'one_to_one_channel_name' => env('NEXTCLOUD_ONE_TO_ONE_CHANNEL_NAME'), ], ...
Usage
You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification; use Molnix\Channels\NextcloudTalkChannel; use Molnix\Channels\NextcloudTalkMessage; class NextcloudNotification extends Notification { public function via(object $notifiable): array { return [NextcloudTalkChannel::class]; } public function toNextcloudTalk() { return NextcloudTalkMessage::create('Hello'); } }
If you want the bot to make a channel with the user and send message (one to one), add routeNotificationForNextcloudTalk to your notifiable model:
public function routeNotificationForNextcloudTalk($notification): string { return $this->username; }
Channel selection order:
- Channel specified using
NextcloudTalkMessage::to(). routeNotificationForNextcloudTalk()default_channelspecified in the config
Available Message methods
to(): To specify a nextcloud channel token, example groups etc.
content(): Sets a content of the notification message.
Testing
$ composer test
Security
If you discover any security related issues, please email vishnu@monlnix.com or johan@molnix.com instead of using the issue tracker.
Contributing
You are welcome to contribute
Credits
License
The MIT License (MIT). Please see License File for more information.
Made with ❤ in Finland with Molnix