elao/web-profiler-extra-bundle
Symfony Web Profiler add-on that adds extra panels for Routing, Service Container, Twig (extensions/tests/filters/functions), and Assetic. Enable per collector and optionally show in the web debug toolbar; intended for dev/test environments.
Installation Add the package via Composer (if not already included in a legacy Symfony/Laravel project):
composer require elao/web-profiler-extra-bundle
Register the bundle in config/app.php (Symfony) or via a service provider (Laravel bridge if applicable):
// Symfony (app/AppKernel.php)
new Elao\WebProfilerExtraBundle\ElaoWebProfilerExtraBundle(),
Enable in Dev Environment
Ensure APP_DEBUG=true in .env (or equivalent) and clear cache:
php artisan cache:clear # Laravel
php app/console cache:clear # Symfony
First Use Case
Inspect Matched Routes: Use the Routing tab to verify route resolution, parameters, and middleware execution.
// Example: Debug a route with dynamic parameters
Route::get('/user/{id}', [UserController::class, 'show']);
user.show).id => 42).auth, throttle).Reverse Route Dumping: Dump all registered routes to a file for documentation:
use Symfony\Component\Routing\RouterInterface;
$routes = $this->container->get(RouterInterface::class)->getRouteCollection();
file_put_contents(storage_path('logs/routes.php'), print_r($routes->all(), true));
Service Binding Debugging: Use the Container tab to:
App\Services\UserService).$this->app->bind('user.service', UserService::class);
Temporary Overrides: Override a service in development for testing:
$this->app->instance('user.service', new MockUserService());
Assetic Debugging:
Twig Template Inspection:
Laravel-Specific Workflows:
config/app.php to see real-time route resolution:
'route.cache' => env('APP_DEBUG') ? false : true,
php artisan view:clear or dd()).Custom Profiler Data: Extend the profiler with custom data (Symfony-only):
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
class CustomDataCollector extends DataCollector {
public function collect(Request $request, Response $response, \Exception $exception = null) {
$this->data['custom_key'] = 'value';
}
}
Register it in config/packages/elao_web_profiler_extra.yaml:
elao_web_profiler_extra:
collectors:
- App\CustomDataCollector
Archived Package:
Laravel Compatibility:
symfony/http-kernel-bundle).dd() or dump() for quick debugging if integration fails.Performance Overhead:
if (app()->environment('production')) {
$this->app->register(\Elao\WebProfilerExtraBundle\ElaoWebProfilerExtraBundle::class);
}
Container Tab Limitations:
$this->app->instance('symfony.container', new class {
public function get($id) { return app($id); }
});
Assetic/Twig Gaps:
symfony/assetic-bundle. For Laravel Mix/Vite, use browser dev tools.symfony/twig-bundle. For Blade, use php artisan view:dump or Xdebug.Route Not Showing?
APP_DEBUG=true and cache is cleared.php artisan route:clear).Container Empty?
$this->app->singleton('symfony.container', function () {
return new class {
public function get($id) { return app($id); }
};
});
Twig/Assetic Data Missing?
composer require symfony/twig-bundle symfony/assetic-bundle
symfony/twig-bridge:
composer require symfony/twig-bridge
Custom Data Not Appearing?
DataCollectorInterface.config/packages/elao_web_profiler_extra.yaml:
elao_web_profiler_extra:
collectors:
- App\CustomCollector
Add Custom Tabs: Create a new collector (Symfony):
namespace App\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
class ApiCollector extends DataCollector {
public function collect(Request $request, Response $response, \Exception $exception = null) {
$this->data['api_calls'] = $request->headers->get('X-API-Calls');
}
public function getName() { return 'api'; }
}
Register in config/packages/elao_web_profiler_extra.yaml:
elao_web_profiler_extra:
collectors:
- App\DataCollector\ApiCollector
Override Existing Data:
Extend core collectors (e.g., RoutingDataCollector) to add custom logic:
use Elao\WebProfilerExtraBundle\DataCollector\RoutingDataCollector;
class CustomRoutingCollector extends RoutingDataCollector {
protected function collect(Request $request) {
parent::collect($request);
$this->data['custom_route_data'] = 'value';
}
}
Bind it in a service provider:
$this->app->extend('data_collector.routing', function () {
return new CustomRoutingCollector();
});
Laravel Middleware Integration: Trigger profiler manually for specific routes:
use Elao\WebProfilerExtraBundle\Profiler;
class DebugMiddleware {
public function handle($request, Closure $next) {
if (app()->bound('profiler')) {
app('profiler')->collect($request);
}
return $next($request);
}
}
How can I help you explore Laravel packages today?