承接 symkit/faq-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

symkit/faq-bundle

最新稳定版本:v0.0.2

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.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固