simon-heimberg / profiler-viewer-bundle
从其他地方查看symfony的配置文件数据
v0.9.0-beta.1
2020-09-24 00:57 UTC
Requires
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.19
- symfony/maker-bundle: ^1.15
This package is auto-updated.
Last update: 2024-09-24 09:18:42 UTC
README
在记录实例之外查看配置文件数据。
通常使用ProfilerViewer应用程序,它使用此包,直接在复杂情况下使用包。
安装
确保已全局安装Composer,如Composer文档中的安装章节所述。
使用Symfony Flex的应用程序
打开命令行,进入您的项目目录并执行
$ composer require simon-heimberg/profiler-viewer-bundle
不使用Symfony Flex的应用程序
步骤 1:下载包
打开命令行,进入您的项目目录,并执行以下命令以下载此包的最新稳定版本
$ composer require simon-heimberg/profiler-viewer-bundle
步骤 2:启用包
然后,通过将其添加到项目config/bundles.php
文件中注册的包列表中,启用包
// config/bundles.php return [ // ... SimonHeimberg\ProfilerViewerBundle\ProfilerViewerBundle::class => ['dev' => true], ];
配置包
步骤 1:导入路由
为了提供路由信息,将路由导入到app/config/routing.yml
中:config/routing/dev/profiler-viewer.yaml
# config/routing/dev/profiler-viewer.yaml _profiler_viewer: resource: "@ProfilerViewerBundle/Resources/config/routing/all.yaml" prefix: /pview # can be adapted when required
步骤 2(可选):启用模板覆盖文件(以指示您正在使用profiler-viewer)
$ mkdir -p templates/bundles/ $ ln -sr vendor/simon_heimberg/profiler_viewer_bundle/Resources/views/overwrite/WebProfilerBundle templates/bundles/
步骤 3(推荐):为路由配置防火墙
配置文件信息可能包含敏感信息。因此,通过保护对应用程序的访问或为以/pview
开头的所有路由配置防火墙来保护数据。
使用包
将PROFILER_VIEWER_PROFILER_PATH
设置在.env.local
中(或作为实际环境变量)以您想要查看数据的配置文件路径。
例如:PROFILER_VIEWER_PROFILER_PATH=/mendia/from_your_system/project/var/cache/prod/profiler/
启用开发模式(APP_ENV=dev
),因为symfony配置文件在prod模式下使用时会发出警告。
导航到页面http://your-app-base-url/pview/。像往常一样使用配置文件。
已知问题
- 路由面板没有显示,因为它会显示当前路由数据