Search by

augusl / laravel-lark-logging

A Laravel package for logging to Lark bot

Maintainers

Package info

github.com/augusl/laravel-lark-logging

pkg:composer/augusl/laravel-lark-logging

Transparency log

Statistics

Installs: 52

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.0 2026-09-01 03:50 UTC

This package is auto-updated.

Last update: 2026-09-01 03:51:51 UTC


README

Send Laravel logs to a Lark or Feishu chat through a custom bot webhook.

Install

This package supports Laravel 11, 12, and 13 on PHP 8.2+. Laravel 13 itself requires PHP 8.3+.

composer require augusl/laravel-lark-logging

Define Lark Bot Webhook URL in your .env file

LARK_WEBHOOK_URL=https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-id-xxxxxx>

Add to config/logging.php file new channel:

'lark' => [
    'driver' => 'custom',
    'via' => PosAppVN\LarkLogger\LarkLogger::class,
    'level' => 'debug',
    'title' => env('APP_NAME', 'Laravel Log'),
    'retries' => 3,
],

Publish the package config file:

php artisan vendor:publish --provider "PosAppVN\LarkLogger\LarkLoggerServiceProvider"

Custom colors by log level

The default mapping remains compatible with previous releases: errors are red, warnings are yellow, info and notice records are blue, and debug records are purple. Override only the levels needed by a channel:

'lark-app-store' => [
    'driver' => 'custom',
    'via' => PosAppVN\LarkLogger\LarkLogger::class,
    'level' => 'debug',
    'webhook_url' => env('LARK_APP_STORE_WEBHOOK_URL'),
    'title' => 'App Store Monitor',
    'level_colors' => [
        'info' => 'green',
        'warning' => 'red',
    ],
],

Level names are case-insensitive. Partial overrides fall back to the default mapping. The selected color is applied to both the card header and level tag, so use a color supported by both Lark or Feishu card elements.

Create bot

Create a custom bot by following the Feishu custom bot guide.

Configure a different webhook per channel

Add webhook_url, title, or level_colors to individual channels in config/logging.php:

[
    'channels' => [

        'lark-log' => [
            'driver' => 'custom',
            'via' => PosAppVN\LarkLogger\LarkLogger::class,
            'level' => 'debug',
            'webhook_url' => 'https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-id-xxxxxx>',
            'title' => 'Laravel Log',
        ],

        'lark-system' => [
            'driver' => 'custom',
            'via' => PosAppVN\LarkLogger\LarkLogger::class,
            'level' => 'error',
            'webhook_url' => 'https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-id-xxxxxx>',
            'title' => 'System Log',
        ],
    ],
]