承接 alitvinenko/laravel-pachka-logging 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alitvinenko/laravel-pachka-logging

Composer 安装命令:

composer require alitvinenko/laravel-pachka-logging

包简介

Send Laravel logs to Pachka messenger via webhook

README 文档

README

CI

Laravel package for sending logs to Pachka messenger via incoming webhook.

Requirements

  • PHP 8.1+
  • Laravel 10, 11 or 12
  • Monolog 3.x

Installation

composer require alitvinenko/laravel-pachka-logging

Configuration

1. Set up Pachka webhook

  1. Open Pachka and go to the channel where you want to receive error notifications
  2. Channel settings → Integrations → Add integration → Incoming webhook
  3. Copy the webhook URL

2. Environment variables

PACHKA_LOGGER_WEBHOOK_URL=https://api.pachca.com/webhooks/incoming/YOUR_WEBHOOK_ID

Optional:

PACHKA_LOGGER_TEMPLATE=pachka-logging::standard
PACHKA_LOGGER_TIMEOUT=10
PACHKA_LOGGER_ASYNC=true
PACHKA_LOGGER_QUEUE_CONNECTION=redis
PACHKA_LOGGER_QUEUE=logs

3. Add logging channel

In config/logging.php:

'pachka' => [
    'driver' => 'custom',
    'via' => Pachka\Logging\PachkaLogger::class,
    'level' => 'error',
],

4. Enable the channel

As the default channel:

LOG_CHANNEL=pachka

Or add to a stack:

LOG_STACK=daily,pachka

Usage

Use standard Laravel logging — messages are sent to Pachka based on the configured level:

Log::error('Payment processing failed', ['order_id' => 123]);
Log::critical('Database connection lost');

Unhandled exceptions are captured automatically via Laravel's exception handler.

Async mode

By default, log messages are sent to Pachka synchronously, which blocks the application until the HTTP request completes. For production environments, you can enable async mode to send messages via Laravel Queue:

PACHKA_LOGGER_ASYNC=true

When async mode is enabled:

  • Messages are formatted immediately (in the request context)
  • HTTP requests to Pachka are sent by the queue worker in the background
  • Failed deliveries are retried automatically (3 attempts with 10s and 30s backoff)
  • Errors are logged to the single channel

Queue configuration

You can isolate Pachka log jobs from your main queue:

PACHKA_LOGGER_QUEUE_CONNECTION=redis
PACHKA_LOGGER_QUEUE=logs

Or configure per-channel in config/logging.php:

'pachka' => [
    'driver' => 'custom',
    'via' => Pachka\Logging\PachkaLogger::class,
    'level' => 'error',
    'async' => true,
    'queue_connection' => 'redis',
    'queue' => 'logs',
],

Make sure your queue worker is running:

php artisan queue:work redis --queue=logs

Message templates

Two built-in templates are available:

  • pachka-logging::standard (default) — app name, environment, timestamp, call location, message and context as pretty-printed JSON
  • pachka-logging::minimal — app name, level and message only

Custom templates

Publish and edit the views, or create your own Blade template:

php artisan vendor:publish --tag=pachka-logger-views
PACHKA_LOGGER_TEMPLATE=your-custom-view-name

Available template variables:

  • $appName — application name
  • $appEnv — environment (production, staging, etc.)
  • $level_name — log level (ERROR, WARNING, etc.)
  • $datetime — Carbon instance with date/time
  • $message — original log message
  • $context — context array (Throwable instances are serialized to arrays with class, message, file and trace)
  • $extra — extra data (URL, HTTP method, IP from WebProcessor; file, line, class, function from IntrospectionProcessor)
  • $formatted — full formatted string with message and context

Publishing config

php artisan vendor:publish --tag=pachka-logger-config

License

MIT

统计信息

  • 总下载量: 467
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固