承接 bitl/debug 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bitl/debug

最新稳定版本:v0.1.5

Composer 安装命令:

composer require bitl/debug

包简介

BitL Debug Integration - Send errors, dumps, and queries to BitL's debug bar

README 文档

README

Send PHP errors, dumps, and queries to BitL's debug bar.

Requirements

  • PHP 8.1+
  • BitL desktop app running

Installation

composer require bitl/debug --dev

For Laravel, the service provider is auto-discovered.

Usage

Dump Variables

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 name

Manual Error Reporting

try {
    // ...
} catch (\Exception $e) {
    BitL::error($e);
    throw $e;
}

Manual Query Logging

BitL::query(
    sql: 'SELECT * FROM users WHERE id = ?',
    bindings: [1],
    time: 2.5,  // milliseconds
    connection: 'mysql'
);

Manual Mail Capture

BitL::mail(
    from: 'noreply@example.com',
    to: ['user@example.com'],
    subject: 'Welcome!',
    html: '<h1>Hello World</h1>',
    text: 'Hello World'
);

Laravel Integration

The package auto-discovers in Laravel and automatically:

  • Logs all database queries
  • Captures outgoing mail

Exception Capturing (Laravel 11+)

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;
    });
})

Exception Capturing (Laravel 8-10)

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;
    });
}

Configuration

Publish the config file:

php artisan vendor:publish --tag=bitl-config

Or use environment variables:

BITL_HOST=127.0.0.1
BITL_PORT=8765
BITL_CAPTURE_ERRORS=true
BITL_CAPTURE_QUERIES=true
BITL_CAPTURE_MAIL=true

Non-Laravel Usage

For 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...

Disabling in Production

The Laravel integration automatically disables in non-local environments.

For manual control:

use BitL\Debug\BitL;

if (getenv('APP_ENV') === 'production') {
    BitL::disable();
}

License

MIT

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固