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

Ladybug Plugin Extra Laravel Package

raulfraile/ladybug-plugin-extra

Extra plugin for the Ladybug PHP debugger/dumper by Raúl Fraile. Adds additional integrations and helpers to extend Ladybug’s output for easier inspection and debugging in your apps.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer (if still available in a private repo or fork):

    composer require raulfraile/ladybug-plugin-extra
    

    Note: Since the last release was in 2013, verify compatibility with your Laravel version (likely 4.x).

  2. Service Provider Register the plugin in config/app.php under providers:

    'providers' => [
        // ...
        'Ladybug\PluginExtra\PluginExtraServiceProvider',
    ],
    
  3. Publish Config (if applicable) Check for a publishes array in the service provider. If no config exists, proceed to usage.

  4. First Use Case Use the plugin’s core feature (e.g., extended logging or debugging tools) in a controller or middleware:

    use Ladybug\PluginExtra\Facades\Ladybug;
    
    Ladybug::extraLog('Custom debug message', ['key' => 'value']);
    

Implementation Patterns

Core Workflows

  1. Debugging Middleware Wrap routes or controllers with the plugin’s extended logging:

    // app/Http/Kernel.php
    protected $middleware = [
        // ...
        \Ladybug\PluginExtra\Middleware\ExtraDebug::class,
    ];
    
  2. Event Listeners Extend Laravel’s event system with Ladybug’s hooks (if documented):

    Ladybug::listen('auth.login', function ($user) {
        Ladybug::extraLog("User {$user->id} logged in", ['ip' => request()->ip()]);
    });
    
  3. Blade Directives (if supported) Add debugging directives to views:

    // In a service provider
    Blade::directive('debug', function () {
        return "<?php Ladybug::extraLog('View rendered', ['view' => __FILE__]); ?>";
    });
    

    Usage in Blade:

    @debug
    

Integration Tips

  • Laravel 4.x Compatibility: Ensure no conflicts with Illuminate\Support\Facades\Facade (use use Ladybug\PluginExtra\Facades\Ladybug; explicitly).
  • Configuration: If the plugin supports config, publish it:
    php artisan config:publish raulfraile/ladybug-plugin-extra
    
  • Testing: Mock the Ladybug facade in PHPUnit:
    $this->app->instance('Ladybug', Mockery::mock('Ladybug\PluginExtra\Facades\Ladybug'));
    

Gotchas and Tips

Pitfalls

  1. Deprecated Laravel Version

    • The package targets Laravel 4.x. Use a polyfill (e.g., laravel-shift/laravel-4-generators) if upgrading or test thoroughly in a 4.x environment.
  2. No Official Documentation

    • Rely on the source code for undocumented features. Key files:
      • src/Ladybug/PluginExtra/PluginExtraServiceProvider.php
      • src/Ladybug/PluginExtra/Facades/Ladybug.php
  3. Facade Conflicts

    • If Ladybug conflicts with other facades, alias it in config/app.php:
      'aliases' => [
          'Ladybug' => 'Ladybug\PluginExtra\Facades\Ladybug',
      ],
      
  4. Static Method Dependencies

    • Avoid static calls (e.g., Ladybug::extraLog()) in testable code. Use dependency injection:
      public function __construct(Ladybug $ladybug) {
          $this->ladybug = $ladybug;
      }
      

Debugging Tips

  • Check Logs: Extended logs may appear in storage/logs/ladybug.log or storage/logs/laravel.log.
  • Enable Debug Mode: Set APP_DEBUG=true in .env to ensure logs aren’t filtered out.
  • Inspect Facade: Dump the facade to understand available methods:
    dd(\Ladybug\PluginExtra\Facades\Ladybug::class);
    

Extension Points

  1. Custom Log Handlers Extend the plugin’s logging by binding a custom handler to the Ladybug facade:

    Ladybug::extend(function ($ladybug) {
        $ladybug->onLog(function ($message, $context) {
            // Custom logic (e.g., Slack notification)
        });
    });
    
  2. Override Default Behavior Replace the service provider or facade bindings in your app’s AppServiceProvider:

    public function register() {
        $this->app->bind('Ladybug', function () {
            return new CustomLadybugExtension();
        });
    }
    
  3. Add New Directives If the plugin lacks features, extend it by creating a new package or fork. Example:

    // app/Providers/LadybugExtraServiceProvider.php
    public function boot() {
        Blade::directive('customDebug', function () {
            // ...
        });
    }
    
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor