flowpack/neos-debug 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flowpack/neos-debug

Composer 安装命令:

composer require flowpack/neos-debug

包简介

Neos CMS helper package to visualize debug information for page rendering

README 文档

README

This plugin is a small helper package to add a debug panel to your Neos CMS website. At this point in time you're able to debug your content cache configuration as well as sql queries. Additionally, the Server-Timing http header can be enabled that will add request timings to responses. Those then can be viewed in the browser network tab.

Note: This is still a very early rough version. Contributions are welcome in any Error. Nevertheless, it's already adding value to your debug experience

This plugin is based on the now unmaintained t3n/neos-debug package and replaces it fully.

Screenshots

Neos CMS Demo Site with debug console showing cache visualization Neos CMS Demo Site with debug console showing database queries Neos CMS Demo Site with debug console showing other metrics Server-Timing header in the browser network tab

Installation & configuration

Install the package via composer

composer require flowpack/neos-debug --dev

The debug mode is disabled by default. To enable it add this to your Settings.yaml

Flowpack:
  Neos:
    Debug:
      enabled: true

To bring up the debug panel run this command in your js console:

__enable_neos_debug()

Disclaimer: Once the debug mode is enabled you might expose sensitive data. Make sure to not use this in production. At least be warned

In a previous version of this package your current user needed a specific role as well. We dropped this requirement for now as you could not use this package if you don't have a frontend login on your site. Once the package is active it will render some metadata in your html output.

To get the debugger running you now need to include some javascript and css to acutally render the debug console. This package ships two fusion prototypes to include all resources. If your Document extends Neos.Neos:Page you don't need to include anything. We already added the resources to Neos.Neos:Page prototype.

HTTP Server-Timing header

The header is disabled by default. To enable it add this to your Settings.yaml

Flowpack:
  Neos:
    Debug:
      serverTimingHeader:
        enabled: true

If you only want the header with all timings but not the debug mode, do this:

Flowpack:
  Neos:
    Debug:                                                  
      enabled: true
      htmlOutput:
        enabled: false
      serverTimingHeader:
        enabled: true

Usage

To enable the cache visualization open your browsers developer console and execute __enable_neos_debug(). This will bring up the debug console at the bottom of your screen.

🔦 Inspect

Once you enable the inspect mode a visualization will pop up and add overlays on your cached parts. Cached parts are marked green, uncached red and dynamic caches are marked yellow. If you hover the loupe you will also see some meta data regarding the cache.

⚡️ Cache

This module will add a new modal including some statistics regarding cache hits and misses as well as a table of all rendered cache entries.

🗄 SQL

In addition to the content cache we're also exposing some debug SQL informations and statistics. It will also detect slow queries. You can configure from when a query should be marked as slow:

Flowpack:
  Neos:
    Debug:
      sql:
        # Set when a query should be considered as slow query. In ms
        slowQueryAfter: 10

Note: this plugin adds its own SQL logger via an aspect during runtime. If you have a custom logger enabled, it will be wrapped and its functionality should remain. If you experience any issues, disable this plugin and check if the problem persists.

🚫 Close

To shutdown the debug console simply close it. If you'd like to persist the active debug state you can add a true to the method

__enable_neos_debug(true)

This will set a cookie and the debug mode will still be active after a page refresh.

Using it in custom Fusion views (e.g. Neos backend modules)

To use the debug widget in custom Fusion views, you can include the necessary resources like this:

    include: resource://Flowpack.Neos.Debug/Private/Fusion/Fragments/Scripts.fusion
    
    My.Package.MyController.index {
        @process.addLoadDebugScript = afx`
            {value}
            <Flowpack.Neos.Debug:Fragment.Scripts/>
        `
    }

With this modification, you can use the __enable_neos_debug() function in your browser console to enable the debug widget.

⚠️Make sure to remove this script in production environments or when in a shared plugin as the prototype might not be available in every environment.

License

Licensed under MIT, see LICENSE

flowpack/neos-debug 适用场景与选型建议

flowpack/neos-debug 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.62k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 flowpack/neos-debug 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 flowpack/neos-debug 我们能提供哪些服务?
定制开发 / 二次开发

基于 flowpack/neos-debug 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-11