kaliop/content-decorator-bundle
Composer 安装命令:
composer require kaliop/content-decorator-bundle
包简介
Decorate your Ibexa content with custom model classes.
README 文档
README
Kaliop Content Decorator Bundle is an Ibexa extension inspired by
eZObjectWrapperBundle. It lets you work with Ibexa Content objects as
typed models plus dedicated repositories.
Instead of using raw content objects everywhere, you map content types to custom classes extending
Kaliop\Contracts\ContentDecorator\Model\ContentDecorator.
Compatibility
| Bundle line | Ibexa | Symfony | PHP |
|---|---|---|---|
| 1.x | 4.6 | 5.4 LTS | >= 8.1 |
| 2.x | 5.0 | 7.4 LTS | >= 8.3 |
Installation
composer require kaliop/content-decorator-bundle
If Symfony Flex does not enable the bundle automatically, register it in config/bundles.php:
return [ Kaliop\Bundle\ContentDecorator\KaliopContentDecoratorBundle::class => ['all' => true], ];
Quick Start
- Configure mappings:
# config/packages/kaliop_content_decorator.yaml kaliop_content_decorator: default_class: App\Model\GenericContent default_repository_class: Kaliop\ContentDecorator\Repository\ContentRepository mappings: App: namespace: 'App\Model' dir: '%kernel.project_dir%/src/Model'
- Create a decorator class:
<?php declare(strict_types=1); namespace App\Model; use Kaliop\ContentDecorator\Attribute\Decorator; use Kaliop\Contracts\ContentDecorator\Model\ContentDecorator; #[Decorator(repositoryClass: App\Repository\ArticleRepository::class, contentTypes: ['article'])] final class Article extends ContentDecorator { }
- Create a repository:
<?php declare(strict_types=1); namespace App\Repository; use Kaliop\ContentDecorator\Repository\AbstractContentRepository; final class ArticleRepository extends AbstractContentRepository { public function findByAuthorId(int $authorId): array { // Implement query logic return []; } }
- Use
ContentDecoratorManagerin your service/controller:
$repository = $contentDecoratorManager->getRepository(App\Model\Article::class); $articles = $repository->findByAuthorId(42);
Configuration
kaliop_content_decorator: default_class: App\Model\GenericContent default_repository_class: Kaliop\ContentDecorator\Repository\ContentRepository mappings: App: namespace: 'App\Model' dir: '%kernel.project_dir%/src/Model' content_types: article: App\Model\Article
Injectors
Decorators are not Symfony services. Use injectors to add services during decoration. Implement
Kaliop\Contracts\ContentDecorator\Injector\InjectorInterface and tag as kaliop.content_decorator.injector
(autoconfiguration handles this automatically).
Default injectors:
ConfigResolverInjectorIbexaRepositoryInjectorImageVariationInjectorLoggerInjectorManagerInjectorTranslatorInjectorUrlGeneratorInjector
Performance and Method-Level Cache
- Decorated instances are cached in memory per request.
- Proxy classes can cache selected method results.
- Mark methods with
#[Cacheable]. - Method parameters must be serializable.
use Kaliop\ContentDecorator\Attribute\Cacheable; #[Cacheable] public function getExpensiveComputation(): array { return []; }
Contribute
The tool comes with quite a few built-in fixers, but everyone is more than welcome to contribute more of them.
License
This library is released under the MIT license. See the included LICENSE file for more information.
kaliop/content-decorator-bundle 适用场景与选型建议
kaliop/content-decorator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 431 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「content」 「symfony-bundle」 「repository-pattern」 「ibexa」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kaliop/content-decorator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kaliop/content-decorator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kaliop/content-decorator-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A block that displays featured content - large image, title, description and link.
The bundle for easy using json-rpc api on your project
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
Symfony bundle for the Rekapager library
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 431
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06