raulfraile/ladybug-theme-modern
Modern theme for the Ladybug PHP dumper. Provides a clean, contemporary look for debugging output, improving readability of variables, arrays, objects, and exceptions during development.
Installation Add the package via Composer:
composer require raulfraile/ladybug-theme-modern
Register the theme in config/ladybug.php:
'theme' => 'modern',
First Use Case Apply the theme to a LadybugPHP project by publishing assets:
php artisan ladybug:publish-modern
Ensure public/css/ladybug-modern.css is linked in your layout:
<link rel="stylesheet" href="{{ asset('css/ladybug-modern.css') }}">
Where to Look First
vendor/raulfraile/ladybug-theme-modern/src/ for SCSS/Less files.README.md for basic overrides (if any).config/ladybug.php for theme-specific settings.Asset Overrides
Extend the theme by copying the original CSS file to resources/css/ladybug-modern.css and modifying it. Use Laravel Mix or Vite to compile if needed.
Dynamic Theming
Toggle the theme via a config toggle (e.g., config(['ladybug.theme' => 'modern'])) or middleware:
// app/Http/Middleware/ThemeMiddleware.php
public function handle($request, Closure $next) {
if ($request->user()->prefers_modern_theme()) {
config(['ladybug.theme' => 'modern']);
}
return $next($request);
}
LadybugPHP Integration Use the theme with Ladybug’s built-in helpers:
// In a controller or view
Ladybug::theme('modern')->render();
Partial Overrides Target specific components (e.g., buttons, forms) by overriding SCSS variables in a custom file:
// resources/scss/overrides.scss
@import 'vendor/raulfraile/ladybug-theme-modern/src/scss/variables';
$button-bg: #3498db; // Override default
Outdated Dependencies
node_modules references).Asset Path Assumptions
public/css/. If using a custom path, update the config or publish manually:
php artisan vendor:publish --tag=ladybug-modern --path=custom/path
SCSS/Less Conflicts
@import sparingly to avoid variable collisions.Browser Caching
<link rel="stylesheet" href="{{ asset('css/ladybug-modern.css?v='.filemtime(public_path('css/ladybug-modern.css'))) }}">
// Add to your overrides
body {
color: red;
@debug $button-bg; // Logs variable value
}
config/ladybug.php to trace theme loading issues.Custom Variables
Extend the theme by defining variables in resources/scss/variables.scss before importing the theme:
@import 'vendor/raulfraile/ladybug-theme-modern/src/scss/variables';
// Override or add new variables here
Theme Switching Create a helper to toggle themes dynamically:
// app/Helpers/ThemeHelper.php
function setLadybugTheme($theme) {
config(['ladybug.theme' => $theme]);
return new \Ladybug\Ladybug(config('ladybug'));
}
Dark Mode
Fork the theme and add dark-mode variables (e.g., $dark-bg: #222;), then use CSS classes to toggle:
<body class="dark-mode">
<!-- Theme applies dark variables -->
</body>
How can I help you explore Laravel packages today?