symkit/faq-bundle 问题修复 & 功能扩展

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

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

symkit/faq-bundle

Composer 安装命令:

composer require symkit/faq-bundle

包简介

A flexible and modular FAQ (Frequently Asked Questions) management bundle for Symfony applications.

README 文档

README

CI Latest Version PHPStan Level 9

FAQ Bundle

A flexible and modular FAQ (Frequently Asked Questions) management bundle for Symfony applications. It provides a configurable administration interface (CRUD), public rendering with Stimulus accordion, and automatic position management for FAQ items.

Requirements

Installation

1. Require via Composer

composer require symkit/faq-bundle

2. Enable the bundle

Register the bundle in config/bundles.php:

return [
    // ...
    Symkit\FaqBundle\SymkitFaqBundle::class => ['all' => true],
];

3. Update database schema

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

Configuration

All features can be enabled or disabled via the bundle configuration. Create or edit config/packages/symkit_faq.yaml:

symkit_faq:
    enabled: true

    admin:
        enabled: true
        route_prefix: /admin

    public:
        enabled: true
        route_prefix: /faq

    entity:
        # Override with your own classes if you extend the default entities
        faq_class: Symkit\FaqBundle\Entity\Faq
        faq_repository_class: Symkit\FaqBundle\Repository\FaqRepository
        faq_item_class: Symkit\FaqBundle\Entity\FaqItem
        faq_item_repository_class: Symkit\FaqBundle\Repository\FaqItemRepository

    doctrine:
        enabled: true

    twig:
        enabled: true

    asset_mapper:
        enabled: true

If you use custom entity or repository classes (e.g. extending the defaults), configure them here and ensure your Doctrine mapping covers the same tables or your overrides.

Routes

Import the bundle routes in your application config/routes.yaml.

Configurable prefixes (recommended; uses admin.route_prefix and public.route_prefix from config):

symkit_faq:
    resource: 'symkit_faq.route_loader::loadRoutes'
    type: service

Fixed paths (/admin, /faq):

symkit_faq:
    resource: '@SymkitFaqBundle/config/routes.yaml'

This registers:

  • Admin: /admin/faqs (list, create, edit, delete), /admin/faqs/{faqId}/items/create, /admin/faq-items/{id}/edit, /admin/faq-items/{id}/delete
  • Public: /faq/{code} (show FAQ by code)

You can wrap the import with a custom prefix if you need to change the URL prefix.

Translations

The bundle provides XLIFF translations in SymkitFaqBundle (and validators for constraint messages) in English and French. Translations are auto-discovered from the bundle translations/ directory.

To override or add locales, place your files in your app’s translations/ directory with the same domain names (SymkitFaqBundle.*.xlf, validators.*.xlf).

Usage

Displaying a FAQ in Twig

Render a FAQ block by code (e.g. from a controller that loaded the entity):

{{ include('@SymkitFaq/faq/components/_faq.html.twig', {
    faq: faq_entity
}) }}

Admin interface

The admin CRUD is available at /admin/faqs (or your configured prefix). It uses symkit/crud-bundle for lists, forms, and actions.

Customizing templates

Override bundle templates under your project:

templates/bundles/SymkitFaqBundle/faq/

Copy the relevant Twig files from vendor/symkit/faq-bundle/templates/faq/ and edit them.

Assets and Stimulus

The bundle registers its Stimulus controller via AssetMapper. Ensure your app uses AssetMapper and that the faq controller is loaded (e.g. in your importmap.php and Stimulus app registration). The accordion uses data-controller="faq" and data-action="faq#toggle".

Components

  • Entities: Faq (group of questions), FaqItem (question/answer with position).
  • Stimulus: faq controller for accordion toggle behaviour.

Dependencies

License

MIT.

symkit/faq-bundle 适用场景与选型建议

symkit/faq-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 symkit/faq-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-22