alitvinenko / laravel-pachka-logging
Send Laravel logs to Pachka messenger via webhook
Package info
github.com/alitvinenko/laravel-pachka-logging
pkg:composer/alitvinenko/laravel-pachka-logging
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^10.0|^11.0|^12.0
- monolog/monolog: ^3.0
Requires (Dev)
- larastan/larastan: ^2.0|^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
Suggests
- illuminate/queue: Required for async (queue-based) log message sending (^10.0|^11.0|^12.0)
This package is auto-updated.
Last update: 2026-04-13 08:59:41 UTC
README
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
- Open Pachka and go to the channel where you want to receive error notifications
- Channel settings → Integrations → Add integration → Incoming webhook
- 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
singlechannel
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 JSONpachka-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