Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Monolog Bridge Laravel Package

php-debugbar/monolog-bridge

Bridge integration between Monolog and PHP DebugBar, sending log records to the DebugBar collector for easier inspection while developing. Useful for Laravel/Symfony or any PHP app using Monolog and DebugBar.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer: composer require php-debugbar/monolog-bridge. Once installed, instantiate the bridge and attach it to your Monolog logger. Typically, in Laravel, you’d hook this into config/logging.php by creating a custom stack channel or extending the Monolog builder. Start by logging a test message (e.g., Log::debug('Debugbar bridge active');) and verify the message appears in the Debugbar’s “Messages” panel. Check the Debugbar UI in your browser—no setup required beyond basic Debugbar and Monolog configuration.

Implementation Patterns

  • Laravel Integration: Register the bridge in App\Providers\AppServiceProvider or via a dedicated service provider. Use DebugBar\Bridge\MonologBridge::attach($logger) to bind the logger instance.
  • Stack Logger Setup: Wrap your application logger (e.g., Stack::make(['single', 'debugbar'])) to combine file/standard logging with Debugbar visualization.
  • Per-Request Context: Ensure context data (e.g., user ID, request ID) added via Log::info($msg, $context) appears in Debugbar with full details—monolog-bridge preserves structured data for easier inspection.
  • Environment-Gated Activation: Only attach the bridge in local or debug environments via environment checks to avoid performance impact in production.

Gotchas and Tips

  • Missing Debugbar Dependency: The bridge requires barryvdh/laravel-debugbar (or standalone Debugbar). If messages don’t appear, confirm the main Debugbar service is running and enabled.
  • Overhead in Production: Though light, the bridge adds minor overhead—disable it via config (debugbar.enabled = false) in non-dev environments.
  • Log Level Filtering: Ensure your logger channel’s level (e.g., debug, info) matches Debugbar’s visibility expectations. A warning-level logger won’t show debug messages unless reconfigured.
  • Custom Handlers: If adding custom handlers, attach the bridge after your primary handlers to avoid duplicate logging.
  • Laravel 10+ Compatibility: This package’s last release is marked 2026—likely a typo—verify compatibility with your Laravel version. Prefer using Laravel’s built-in logging bridge ( Illuminate\Log\Listeners\MakeDebugbarListener) if available.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui