nfaiz/dbtoolbar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

nfaiz/dbtoolbar

Composer 安装命令:

composer require nfaiz/dbtoolbar

包简介

CodeIgniter 4 Database Debug Toolbar Query Highlighter.

README 文档

README

GitHub GitHub repo size Hits

Query Highlighter

Description

CodeIgniter 4 Database Debug Toolbar Query Highlighter.

Table of contents

Requirement

Installation

Install library via composer:

composer require nfaiz/dbtoolbar

Query Highlighter is located at DbQueries tab (Debug Toolbar)

Configuration

Remove Default Database Tab

  1. Open and comment Database::class from $collectors property in app/Config/Toolbar.php.
public array $collectors = [
    // Database::class,
];
  1. Open and comment Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); in app/Config/Events.php.
if (CI_DEBUG && ! is_cli()) {
  // Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
  Services::toolbar()->respond();
}

Modify Settings.

Open and add properties below in app/Config/Toolbar.php accordingly.

/**
 * -------------------------------------------------------------
 * Disable DbToolbar query Highlighter
 * -------------------------------------------------------------
 * 
 * To disable DbToolbar query highlighter, change value to true
 *
 * @var bool
 */
public bool $dbToolbarDisable = false;

/**
 * -------------------------------------------------------------
 * DbToolbar Theme
 * -------------------------------------------------------------
 * 
 * Configuration for light and dark mode SQL Syntax Highlighter.
 * Refer https://github.com/scrivo/highlight.php/tree/master/src/Highlight/styles or
 * use \HighlightUtilities\getAvailableStyleSheets(); for available stylesheets.
 *
 * @var array
 */
public array $dbToolbarTheme = [
    'light' => 'atom-one-light',
    'dark'  => 'atom-one-dark'
];

/**
 * -------------------------------------------------------------
 * DbToolbar View
 * -------------------------------------------------------------
 * 
 * To override DbToolbar SQL Syntax Highlighter view.
 *
 * @var array
 */
public string $dbToolbarTpl = 'Nfaiz\DbToolbar\Views\database.tpl';

/**
 * -------------------------------------------------------------
 * Bottom Margin Between Diplayed Query in Toolbar
 * -------------------------------------------------------------
 * 
 * Value in px
 * 
 * @var int
 */
public int $dbToolbarMarginBottom = 4;

/**
 * -------------------------------------------------------------
 * Log Queries
 * -------------------------------------------------------------
 *
 * Please set threshold to minimum 7 at app/Config/Logger.php
 * Logs can be found at ROOTPATH/writable/logs
 *
 * @var boolean
 */
public bool $dbToolbarLogger = false;

Custom Syntax Highlighter view.

Open app/Config/Toolbar.php and add/edit template view file using $dbToolbarTpl property.
You can create your own view and you change it accordingly. For Example public $dbToolbarTpl = dbtoolbar/database;

Views/dbtoolbar/database.php.

{! hlstyle !}
<table>
    <thead>
        <tr>
            <th class="debug-bar-width6r">Time</th>
            <th>Query String</th>
        </tr>
    </thead>
    <tbody>
    {queries}
        <tr class="{class}" title="{hover}" data-toggle="{qid}-trace">
            <td class="narrow" style="vertical-align: top;">{duration}</td>
            <td><u>{trace-file}</u>{! sql !}</td>
        </tr>
        <tr class="muted debug-bar-ndisplay" id="{qid}-trace">
            <td></td>
            <td>
            {trace}
                {index}<strong>{file}</strong><br/>
                {function}<br/><br/>
            {/trace}
            </td>
        </tr>
    {/queries}
    </tbody>
</table>

Screenshot

Default Database Toolbar

  • Light

Light mode

  • Dark

Dark mode

Using DbToolbar

  • Light

Light mode

  • Dark

Dark mode

Credit

统计信息

  • 总下载量: 8.87k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固