alitvinenko/laravel-pachka-logging

Send Laravel logs to Pachka messenger via webhook

Maintainers

Package info

github.com/alitvinenko/laravel-pachka-logging

pkg:composer/alitvinenko/laravel-pachka-logging

Statistics

Installs: 65

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.0 2026-04-13 08:59 UTC

This package is auto-updated.

Last update: 2026-04-13 08:59:41 UTC


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