sikessem/laravel-devtools
Laravel DevTools bundles development, debugging, testing, and automation helpers for Laravel. Install via Composer as a dev dependency. Requires PHP 8.3+ (8.3.29+ recommended) and Composer v2+.
Installation Add the package via Composer:
composer require sikessem/laravel-devtools --dev
Publish the config (if needed):
php artisan vendor:publish --provider="Sikessem\DevTools\DevToolsServiceProvider" --tag="config"
First Use Case
Run the devtools:serve command to start a local development server with built-in debugging tools:
php artisan devtools:serve
Access the dashboard at http://localhost:8000/devtools.
Key Features to Explore
Debugging HTTP Requests
Use the Request Inspector to log and inspect incoming requests during development:
// Enable request logging in a route or middleware
use Sikessem\DevTools\Facades\DevTools;
Route::get('/debug', function () {
DevTools::logRequest(); // Logs the current request
return response()->json(['status' => 'logged']);
});
Query Analysis
Enable the query logger in config/devtools.php:
'query_logger' => [
'enabled' => env('DB_QUERY_LOGGER_ENABLED', true),
],
View logged queries in the Database tab of the DevTools dashboard.
Route Debugging
Use the Route Debugger to inspect routes dynamically:
php artisan devtools:routes
Or integrate it into your routes file:
Route::get('/debug-routes', function () {
return DevTools::debugRoutes();
});
Artisan Command Testing Test commands interactively without running them in the terminal:
use Sikessem\DevTools\Facades\DevTools;
Route::get('/test-command', function () {
return DevTools::testCommand('migrate:fresh --seed');
});
Middleware Integration Add DevTools middleware to log requests globally:
// In app/Http/Kernel.php
protected $middleware = [
\Sikessem\DevTools\Http\Middleware\LogRequests::class,
];
asset_logger in the config.Queue Inspector tab.DevTools::logEvent($event);
Performance Overhead
config/devtools.php for production-like environments:
'enabled' => env('DEVTOOLS_ENABLED', false),
devtools:serve in production.Query Logger Conflicts
Route Caching Issues
Route Debugger doesn’t reflect changes:
php artisan route:clear
Session Storage
file, database).Archived Package Risks
barryvdh/laravel-debugbar or nunomaduro/collision.Log Clearance Clear DevTools logs manually via:
php artisan devtools:clear
Or programmatically:
DevTools::clearLogs();
Configuration Quirks
devtools:serve command defaults to port 8000. Change it in config/devtools.php:
'server' => [
'port' => 8080,
],
devtools middleware is not registered in app/Http/Kernel.php for production.Custom Data Logging Log custom data to the dashboard:
DevTools::logCustom('user_action', ['action' => 'login', 'user_id' => 1]);
Custom Dashboard Tabs Extend the dashboard by creating a service provider:
use Sikessem\DevTools\Contracts\DevToolsTab;
class CustomTab implements DevToolsTab {
public function name() { return 'Custom Tab'; }
public function view() { return 'devtools::custom.tab'; }
public function data() { return ['key' => 'value']; }
}
Register it in config/devtools.php:
'tabs' => [
\App\Providers\CustomTab::class,
],
Event Listeners
Listen for DevTools events (e.g., DevToolsRequestLogged):
use Sikessem\DevTools\Events\RequestLogged;
Event::listen(RequestLogged::class, function ($event) {
// Custom logic when a request is logged
});
Override Views Publish and override DevTools views:
php artisan vendor:publish --tag="devtools-views"
Modify files in resources/views/vendor/devtools/.
API Access Access DevTools data via HTTP API (if enabled in config):
$logs = DevTools::api()->getLogs();
How can I help you explore Laravel packages today?