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.
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).
Service Provider
Register the plugin in config/app.php under providers:
'providers' => [
// ...
'Ladybug\PluginExtra\PluginExtraServiceProvider',
],
Publish Config (if applicable)
Check for a publishes array in the service provider. If no config exists, proceed to usage.
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']);
Debugging Middleware Wrap routes or controllers with the plugin’s extended logging:
// app/Http/Kernel.php
protected $middleware = [
// ...
\Ladybug\PluginExtra\Middleware\ExtraDebug::class,
];
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()]);
});
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
Illuminate\Support\Facades\Facade (use use Ladybug\PluginExtra\Facades\Ladybug; explicitly).php artisan config:publish raulfraile/ladybug-plugin-extra
Ladybug facade in PHPUnit:
$this->app->instance('Ladybug', Mockery::mock('Ladybug\PluginExtra\Facades\Ladybug'));
Deprecated Laravel Version
laravel-shift/laravel-4-generators) if upgrading or test thoroughly in a 4.x environment.No Official Documentation
src/Ladybug/PluginExtra/PluginExtraServiceProvider.phpsrc/Ladybug/PluginExtra/Facades/Ladybug.phpFacade Conflicts
Ladybug conflicts with other facades, alias it in config/app.php:
'aliases' => [
'Ladybug' => 'Ladybug\PluginExtra\Facades\Ladybug',
],
Static Method Dependencies
Ladybug::extraLog()) in testable code. Use dependency injection:
public function __construct(Ladybug $ladybug) {
$this->ladybug = $ladybug;
}
storage/logs/ladybug.log or storage/logs/laravel.log.APP_DEBUG=true in .env to ensure logs aren’t filtered out.dd(\Ladybug\PluginExtra\Facades\Ladybug::class);
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)
});
});
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();
});
}
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 () {
// ...
});
}
How can I help you explore Laravel packages today?