定制 rocont/laravel-blade-debugbar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rocont/laravel-blade-debugbar

最新稳定版本:v2.0.1

Composer 安装命令:

composer require rocont/laravel-blade-debugbar

包简介

Laravel Debugbar tab that shows variables passed to Blade views

README 文档

README

A Laravel Debugbar extension that adds a Blade Variables tab showing all variables passed to Blade views.

Features

  • Displays all variables passed to each Blade template in a dump()-like format
  • Automatically filters out Laravel system variables (__env, app, errors, etc.)
  • Converts Eloquent models and collections to arrays for readable output
  • Marks or hides shared variables (View::share())
  • Optional grouping by view name
  • Alphabetical sorting

Requirements

Installation

composer require --dev rocont/laravel-blade-debugbar

The service provider is registered automatically via Laravel Package Discovery.

Configuration

Publish the config file:

php artisan vendor:publish --tag=blade-debugbar-config

This creates config/blade-debugbar.php:

return [

    // Group variables by Blade view name (e.g. "welcome → $title")
    'group_by_view' => false,

    // Additional variables to exclude (system variables are always excluded)
    'excluded_variables' => [],

    // How to handle View::share() variables: "mark", "hide", or "show"
    'shared_mode' => 'mark',

];

Options

Option Values Default Description
group_by_view true / false false Group variables by Blade view name
excluded_variables array [] Additional variable names to exclude
shared_mode mark / hide / show mark How to display shared variables

Shared mode

  • mark — shared variables are shown with a [shared] prefix, e.g. [shared] $currentUser
  • hide — shared variables are excluded completely
  • show — shared variables are shown without any distinction

Usage

Once installed, open any page in your Laravel app. The Debugbar will show a new Blade Variables tab with all variables passed to each rendered Blade template.

Example output

Flat mode (group_by_view: false):

$posts          → array (3) [...]
$title          → "Blog"
[shared] $user  → array ["id" => 1, "name" => "John"]

Grouped mode (group_by_view: true):

blog.index → $posts    → array (3) [...]
blog.index → $title    → "Blog"
layouts.app → [shared] $user → array ["id" => 1, "name" => "John"]

Testing

composer test

Or directly:

vendor/bin/phpunit

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固