Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

The package overrides the default Laravel's VarDumpers and file context disappears

未关闭
#95 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
laravel, php

调研方向

首先检查 DumpServerServiceProvider,并重现有无 php artisan dump-server 时的差异,重点关注 Laravel 的 HtmlDumper 和 CliDumper 处理器。查看 package 如何注册 VarDumper,以及如何启用 command;当 command 未运行时文件上下文仍保持可见,且不破坏 dump-server 的行为时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

When this package is installed, it overrides VarDumper handler that comes from Laravel (Illuminate\Foundation\Http\HtmlDumper and Illuminate\Foundation\Console\CliDumper).

To compare, when the package is not installed:
Screenshot 2024-11-21 at 13 04 11

And when it is installed, but the command not running:
Screenshot 2024-11-21 at 13 04 28

The same in CLI.

When the command (php artisan dump-server) is not running, I would like to see the file context by default.


Suggestion:

As a suggestion, maybe the setting could be introduced to enable/disable the package? E.g. config:

...
    'enabled' => env('DUMP_SERVER_ENABLED', true),
...

Then in DumpServerServiceProvider it could be conditionally loaded:

        if ($this->app['config']->get('debug-server.enabled')) {
            VarDumper::setHandler(function ($var) use ($connection) {
                $this->app->makeWith(Dumper::class, ['connection' => $connection])->dump($var);
            });
        }

The command php artisan dump-server could give an error if it is not enabled:

        if (! config('dump-server.enabled')) {
            $this->error('The dump server is not enabled.');

            return;
        }

This would allow users to choose if they want it always enabled, or occasionally and would not override other VarDump registered handlers.

WDYT, I could open a pull request if it's reasonable idea.

主要语言
PHP
星标
1.6k
派生
90
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

beyondcode/laravel-dump-server 的其他 Issue

查看 beyondcode/laravel-dump-server 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。