yajianguo / lark-notification-channel
Lark Notifications driver
Requires
- php: ^7.2.5 || ^8.0
- guzzlehttp/guzzle: ^6.2 || ^7.0
- illuminate/notifications: ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^4.0 || ^5.0 || ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-05-08 10:54:03 UTC
README
This package makes it easy to send Lark using the Laravel notification system. Supports 5.5+, 6.x, 7.x and 8.x.
Contents
Installation
You can install the package via composer:
composer require yajianguo/lark-notification-channel
Usage
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\Lark\LarkChannel; use NotificationChannels\Lark\LarkMessage; use Illuminate\Notifications\Notification; class ProjectCreated extends Notification { public function via($notifiable) { return [LarkChannel::class]; } public function toLark($notifiable) { return LarkMessage::create() ->url('https://open.feishu.cn/open-apis/bot/v2/hook/selfPath') ->data([ 'payload' => [ 'lark' => 'data' ] ]) ->userAgent("Custom-User-Agent") ->header('X-Custom', 'Custom-Header'); } }
In order to let your Notification know which URL should receive the Lark data, add the routeNotificationForLark
method to your Notifiable model.
Url or Model POST request.
public function routeNotificationForLark() { return 'http://requestb.in/1234x'; }
Available methods
url('')
: Accepts a string value for the Lark url.data('')
: Accepts a JSON-encodable value for the Lark body.query('')
: Accepts an associative array of query string values to add to the request.userAgent('')
: Accepts a string value for the Lark user agent.header($name, $value)
: Sets additional headers to send with the POST Lark.
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email a@a.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.