当前位置: 首页 > 工具软件 > db-dumper > 使用案例 >

Composer加载的symfony/var-dumper类库 字体大小样式设置

束志业
2023-12-01

symfony/var-dumper字体大小设置

###1、composer.json 中加载 symfony/var-dumper 类库 并在git中composer install后,发现 调试dump的时候 打印字体太小,于是找到以下文件:
####Path:项目根目录\vendor\symfony\var-dumper\Dumper\HtmlDumper.php

2、找到如下代码修改font属性样式:

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Cursor;
use Symfony\Component\VarDumper\Cloner\Data;

/**
 * HtmlDumper dumps variables as HTML.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class HtmlDumper extends CliDumper
{
    public static $defaultOutput = 'php://output';

    protected $dumpHeader;
    protected $dumpPrefix = '<pre class=sf-dump id=%s data-indent-pad="%s">';
    protected $dumpSuffix = '</pre><script>Sfdump("%s")</script>';
    protected $dumpId = 'sf-dump';
    protected $colors = true;
    protected $headerIsDumped = false;
    protected $lastDepth = -1;
    protected $styles = array(
        'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:25px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal',
        'num' => 'font-weight:bold; color:#1299DA',
        'const' => 'font-weight:bold',
        'str' => 'font-weight:bold; color:#56DB3A',
        'note' => 'color:#1299DA',
        'ref' => 'color:#A0A0A0',
        'public' => 'color:#FFFFFF',
        'protected' => 'color:#FFFFFF',
        'private' => 'color:#FFFFFF',
        'meta' => 'color:#B729D9',
        'key' => 'color:#56DB3A',
        'index' => 'color:#1299DA',
    );

在以上代码 第34行: protected $styles = array()中的 ‘default’ => 中修改font(我已经修改为font:25px Memlo…)


至此可以显示合适大小的 dump字体。

#(之前网上搜了相关的办法,没找到,索性自己解决,发表解决办法在这里,希望帮到需要的人。)

(满意的 求 点赞,谢啦)
(不懂的可以评论@我哦,随时欢迎您的骚扰,哈哈,欢迎 分享转载)

 类似资料: