Send PHP errors, dumps, and queries to BitL's debug bar.
- PHP 8.1+
- BitL desktop app running
composer require bitl/debug --devFor Laravel, the service provider is auto-discovered.
use BitL\Debug\BitL;
// Send a dump to BitL
BitL::dump($user);
// Or use the helper functions
bd($user); // BitL Dump
bdd($user); // BitL Dump and Die
bitl_dump($user); // Explicit function nametry {
// ...
} catch (\Exception $e) {
BitL::error($e);
throw $e;
}BitL::query(
sql: 'SELECT * FROM users WHERE id = ?',
bindings: [1],
time: 2.5, // milliseconds
connection: 'mysql'
);BitL::mail(
from: 'noreply@example.com',
to: ['user@example.com'],
subject: 'Welcome!',
html: '<h1>Hello World</h1>',
text: 'Hello World'
);The package auto-discovers in Laravel and automatically:
- Logs all database queries
- Captures outgoing mail
For Laravel 11+, add exception reporting in bootstrap/app.php:
->withExceptions(function (Exceptions $exceptions) {
$exceptions->reportable(function (\Throwable $e) {
if (class_exists(\BitL\Debug\BitL::class)) {
\BitL\Debug\BitL::error($e);
}
return false;
});
})For Laravel 8-10, add to app/Exceptions/Handler.php:
public function register(): void
{
$this->reportable(function (\Throwable $e) {
\BitL\Debug\BitL::error($e);
return false;
});
}Publish the config file:
php artisan vendor:publish --tag=bitl-configOr use environment variables:
BITL_HOST=127.0.0.1
BITL_PORT=8765
BITL_CAPTURE_ERRORS=true
BITL_CAPTURE_QUERIES=true
BITL_CAPTURE_MAIL=trueFor non-Laravel PHP projects, register the error handler manually:
require 'vendor/autoload.php';
use BitL\Debug\BitL;
// Register error and exception handlers
BitL::register();
// Your code...The Laravel integration automatically disables in non-local environments.
For manual control:
use BitL\Debug\BitL;
if (getenv('APP_ENV') === 'production') {
BitL::disable();
}MIT