mini-symfony / companion-bundle

此包添加了多个辅助工具,如 debug:container 命令

0.1.2 2016-12-08 10:32 UTC

This package is auto-updated.

Last update: 2024-09-13 20:50:19 UTC


README

此包还可以与 MicroFramework 包一起使用

调试工具

控制台命令

  • debug:container
  • debug:router
  • debug:event-dispatcher

调试栏(默认禁用)

使用调试栏,您可以收集以下信息

  • 环境信息
  • 当前路由
  • 请求信息
  • 查询
  • 事件
  • 时间线

配置

routes.yml

...
companion_bundle:
  resource: '@CompanionBundle/Resources/config/routes.yml'
  prefix: _debugbar

config.yml

mini_symfony:
  debug:
    debugbar:
      enabled: false
      
      # Enable/disable DataCollectors
      collectors:
        events: false
        exceptions: false
        request: true
        routing: true
        phpinfo: true
        kernel: true
        time: true
        memory: true
        queries: false

      # Configure some DataCollectors
      options:
        queries:
          with_params: true # Render SQL with the parameters substituted
          timeline: false # Add the queries to the timeline
          explain:
            enabled: false
            types:
              - SELECT # SELECT, INSERT, UPDATE, DELETE for MySQL 5.6.3+
          hints: true # Show hints for common mistakes
        routing:
          label: true

查询收集器

获取您查询的性能信息。

配置

  1. 为您的 dbal 连接启用查询记录器
services:
  dbal_logger:
    class: Doctrine\DBAL\Logging\DebugStack  
  
  dbal_config:
    class: Doctrine\DBAL\Configuration
    calls:
      - [setSQLLogger, ['@dbal_logger']]
  
  dbal:
    class: Doctrine\DBAL\Connection
    factory: ['Doctrine\DBAL\DriverManager', getConnection]
    arguments:
      - '%database%'
      - '@dbal_config'
  1. 为查询收集器启用额外选项
...
options:
    queries:
      with_params: true # Render SQL with the parameters substituted
      timeline: false # Add the queries to the timeline
      explain:
        enabled: false
        types:
          - SELECT # SELECT, INSERT, UPDATE, DELETE for MySQL 5.6.3+
      hints: true # Show hints for common mistakes