# 将 symfony 的 [dump server](https://symfony.com/doc/current/components/var_dumper.html#the-dump-server) 集成到 Yii 中  ## 安装 ``` bash $ composer require guanguans/yii-var-dumper -v ``` ## 配置 配置文件 `config/main.php` 中添加: ``` php ... 'bootstrap' => [ ... 'dumper', ... ], 'modules' => [ ... 'dumper' => [ 'class' => 'Guanguans\YiiVarDumper\Module', // 'host' => 'tcp://127.0.0.1:9913', ], ... ], ... ``` ## 使用 ### 启动运行 `dump server` ``` bash $ php yii dumper/server ``` ### 使用 --format 选项将输出格式设置为 HTML ``` bash $ php yii dumper/server --format=html > dump.html # or $ php yii dumper/server -f=html > dump.html ``` ### 调试输出你的变量 ``` php <?php dump($yourVariate); ``` ### 输出结果 <img width="1122" alt="cli" src="https://user-images.githubusercontent.com/22309277/94648679-9990a980-0325-11eb-8764-57a0901a16c6.png"> <img width="1142" alt="html" src="https://user-images.githubusercontent.com/22309277/94648698-9d243080-0325-11eb-8237-018824dc4e34.png"> ## 项目地址 * [https://github.com/guanguans/yii-var-dumper](https://github.com/guanguans/yii-var-dumper) ## 相关链接 * [https://github.com/symfony/var-dumper](https://github.com/symfony/var-dumper), by [symfony](https://github.com/symfony) * [https://github.com/beyondcode/laravel-dump-server](https://github.com/beyondcode/laravel-dump-server), by [beyondcode](https://github.com/beyondcode)
将 symfony 的 dump server 集成到 Yii 中
安装
配置
配置文件
config/main.php中添加:使用
启动运行
dump server使用 --format 选项将输出格式设置为 HTML
调试输出你的变量
输出结果
项目地址
相关链接