承接 alengo/sulu-category-extra-bundle 相关项目开发

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

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

alengo/sulu-category-extra-bundle

Composer 安装命令:

composer require alengo/sulu-category-extra-bundle

包简介

Additional Data tab for Sulu CMS Categories — generic JSON field with configurable forms

README 文档

README

Adds an Additional Data tab to the Sulu CMS category admin form. Stores arbitrary extra fields as a JSON column on the existing ca_categories table — no additional tables required.

Features

  • Adds a configurable tab to the Sulu category edit form
  • Stores extra fields as a JSON blob on the Category entity
  • Form definition is fully controlled by the project via a standard Sulu form XML file
  • Tab title, form key, and resource key are configurable
  • Follows the same patterns as alengo/sulu-contact-account-extra-bundle

Requirements

  • PHP 8.2+
  • Sulu CMS ~3.0

Installation

1. Add the bundle

From Packagist:

composer require alengo/sulu-category-extra-bundle

2. Register the bundle

Add to config/bundles.php:

Alengo\SuluCategoryExtraBundle\AlengoSuluCategoryExtraBundle::class => ['all' => true],

3. Register the routes

Add to config/routes/sulu_admin.yaml:

CategoryExtraBundle:
    resource: "@AlengoSuluCategoryExtraBundle/Resources/config/routing_admin_api.yaml"
    prefix: /admin/api

4. Create the form definition

Create config/forms/category_additional_data.xml in your project:

<?xml version="1.0" ?>
<form xmlns="http://schemas.sulu.io/template/template"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd"
>
    <key>category_additional_data</key>

    <properties>
        <property name="theme" type="single_select" colspan="12">
            <meta>
                <title lang="de">Theme</title>
                <title lang="en">Theme</title>
            </meta>
            <params>
                <param name="values" type="collection">
                    <param name="">
                        <meta>
                            <title lang="en">Default</title>
                            <title lang="de">Standard</title>
                        </meta>
                    </param>
                    <param name="blue">
                        <meta>
                            <title lang="en">Blue</title>
                            <title lang="de">Blau</title>
                        </meta>
                    </param>
                </param>
            </params>
        </property>
    </properties>
</form>

Any standard Sulu field type (text_line, single_select, text_editor, media_selection, etc.) can be used. All fields are stored as top-level keys in the JSON blob.

5. Run the database migration

php bin/console doctrine:schema:update --force

This adds an additionalData JSON column to the existing ca_categories table.

Configuration

The bundle works out of the box with its defaults. To override any setting, add to config/packages/alengo_sulu_category_extra.yaml:

alengo_sulu_category_extra:
    entity_class: Alengo\SuluCategoryExtraBundle\Entity\Category  # default
    form_key: category_additional_data                             # default
    resource_key: category_additional_data                         # default
    tab_title: sulu_admin.app.additional_data                      # default
Option Description
entity_class The extended Category entity class to use
form_key Must match the <key> in your form XML file
resource_key Resource key used by the Sulu admin frontend
tab_title Translation key or literal string shown as the tab label

Reading additional data in Twig

The additionalData field is available on every Category entity. To read it in a Twig template, retrieve the category via the Sulu category manager or repository and access the extra fields:

{# category is an instance of the extended Category entity #}
{% set theme = category.additionalData.theme ?? '' %}

When categories are passed through Sulu's standard API (e.g. navigation, content types), you may need to load the entity directly to access additionalData:

use Alengo\SuluCategoryExtraBundle\Entity\Category;
use Sulu\Bundle\CategoryBundle\Entity\CategoryInterface;

$category = $entityManager->getRepository(CategoryInterface::class)->find($id);
if ($category instanceof Category) {
    $theme = $category->getAdditionalData()['theme'] ?? '';
}

API Endpoints

The bundle exposes two admin API endpoints (protected by Sulu's category security context):

Method Path Description
GET /admin/api/category-additional-data/{id} Load additional data for a category
PUT /admin/api/category-additional-data/{id} Save additional data for a category

Both endpoints return a JSON object with the category id plus all stored additional fields as top-level keys.

alengo/sulu-category-extra-bundle 适用场景与选型建议

alengo/sulu-category-extra-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「category」 「cms」 「extend」 「sulu」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 alengo/sulu-category-extra-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 45
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-04