PHPackages                             tourze/cms-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. tourze/cms-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

tourze/cms-bundle
=================

CMS内容管理系统核心功能包

0.0.3(11mo ago)0781MITPHPPHP ^8.1CI failing

Since Jun 3Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/cms-bundle)[ Packagist](https://packagist.org/packages/tourze/cms-bundle)[ RSS](/packages/tourze-cms-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (56)Versions (4)Used By (1)

CMS Bundle
==========

[](#cms-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![PHP Version](https://camo.githubusercontent.com/6518db1335bf20fdff07253dc6d6d0cec955b5fb6a8ef1382ac6d73687ecc07f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d626c7565)](https://camo.githubusercontent.com/6518db1335bf20fdff07253dc6d6d0cec955b5fb6a8ef1382ac6d73687ecc07f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d626c7565)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)[![Build Status](https://camo.githubusercontent.com/b0c6c6845a74cb65a7f0a32bdcfd8fbf80eeb40026c4029af424ab371c94b8bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e)](https://camo.githubusercontent.com/b0c6c6845a74cb65a7f0a32bdcfd8fbf80eeb40026c4029af424ab371c94b8bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e)[![Coverage](https://camo.githubusercontent.com/4acdfc4d8763aff963122b0461de8c76eecdd38ac56d80eeab6b4a6515ce778b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d38302532352d79656c6c6f77677265656e)](https://camo.githubusercontent.com/4acdfc4d8763aff963122b0461de8c76eecdd38ac56d80eeab6b4a6515ce778b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d38302532352d79656c6c6f77677265656e)

A comprehensive CMS (Content Management System) bundle for Symfony applications, providing content management, category organization, tagging, and statistics features.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Basic Entity Structure](#basic-entity-structure)
    - [Services](#services)
    - [JSON-RPC Procedures](#json-rpc-procedures)
    - [Events](#events)
    - [Twig Extensions](#twig-extensions)
- [Database Schema](#database-schema)
- [Advanced Usage](#advanced-usage)
- [Testing](#testing)
- [Requirements](#requirements)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **Content Management**: Entity-Attribute-Value (EAV) based content model
- **Category System**: Hierarchical content categorization
- **Tag Management**: Flexible tagging system with tag groups
- **Search &amp; Statistics**: Content search logs and visit statistics
- **Event System**: Content collection, liking, and visit tracking
- **JSON-RPC API**: RESTful API endpoints for content operations
- **Admin Interface**: EasyAdmin integration for backend management
- **Twig Extensions**: Template helpers for CMS functionality

Installation
------------

[](#installation)

```
composer require tourze/cms-bundle
```

Configuration
-------------

[](#configuration)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    Tourze\CmsBundle\Tourze\CmsBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

### Basic Entity Structure

[](#basic-entity-structure)

The bundle provides 6 core entities:

- **Category**: Hierarchical content categorization with tree structure
- **SearchLog**: Search history tracking and keyword analytics
- **Tag**: Content tagging system with unique tag names
- **TagGroup**: Organization and grouping of tags
- **Topic**: Content topics/articles with recommendation support
- **VisitStat**: Daily visit statistics tracking

### Services

[](#services)

#### ContentService

[](#contentservice)

Search content by keywords in EAV attributes:

```
use Tourze\CmsBundle\Service\ContentService;

class YourController
{
    public function __construct(
        private ContentService $contentService
    ) {}

    public function searchContent(string $keyword): void
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $this->contentService->searchByKeyword($queryBuilder, $keyword);
    }
}
```

#### StatService

[](#statservice)

Update visit statistics asynchronously:

```
use Tourze\CmsBundle\Service\StatService;

class YourController
{
    public function __construct(
        private StatService $statService
    ) {}

    public function updateStats(int $entityId): void
    {
        $this->statService->updateStat($entityId);
    }
}
```

### JSON-RPC Procedures

[](#json-rpc-procedures)

The bundle provides JSON-RPC endpoints for:

#### Content Operations

[](#content-operations)

- `GetCmsEntityList`: Retrieve paginated content lists with category/model filtering
- `GetCmsEntityDetail`: Get detailed content information with visit tracking

#### Category Management

[](#category-management)

- `GetCmsCategoryList`: Fetch category listings by model
- `GetCmsCategoryDetail`: Get category details
- `AdminCreateCmsCategory`: Create new categories (admin)
- `AdminGetCmsCategoryList`: Admin category management
- `AdminGetCmsCategoryTree`: Hierarchical category tree structure

### Events

[](#events)

The bundle dispatches events for content interactions:

- `CollectEntityEvent`: When content is collected/bookmarked
- `LikeEntityEvent`: When content is liked
- `VisitEntityEvent`: When content is visited

### Twig Extensions

[](#twig-extensions)

Use CMS functionality in templates:

```
{# Get single entity detail #}
{% set entity = get_cms_entity_detail(123) %}
{{ entity.title }}

{# Get entity list by model #}
{% set entities = get_cms_entity_list('article', 10, 0) %}
{% for entity in entities %}
    {{ entity.title }}
{% endfor %}
```

Database Schema
---------------

[](#database-schema)

The bundle creates the following tables:

- `cms_category`: Hierarchical content categories with tree structure
- `ims_cms_search`: Search history logs with keyword tracking
- `cms_tag`: Content tags with unique names
- `cms_tag_group`: Tag organization groups
- `cms_topic`: Content topics with recommendation support
- `cms_visit_stat`: Daily visit statistics

Advanced Usage
--------------

[](#advanced-usage)

### Custom Entity Models

[](#custom-entity-models)

Extend the EAV model system for custom content types:

```
use Tourze\CmsBundle\Service\EntityService;use Tourze\CmsBundle\Service\ModelService;

class CustomContentService
{
    public function __construct(
        private ModelService $modelService,
        private EntityService $entityService
    ) {}

    public function createCustomEntity(string $modelCode, array $data): Entity
    {
        $model = $this->modelService->findValidModelByCode($modelCode);
        // Create and populate entity...
    }
}
```

### Advanced Search Integration

[](#advanced-search-integration)

Implement complex search scenarios using ContentService:

```
use Tourze\CmsBundle\Service\ContentService;

$qb = $entityRepository->createQueryBuilder('e');
$this->contentService->searchByKeyword($qb, 'search term', $model);
$results = $qb->getQuery()->getResult();
```

### Cross-Module Integration

[](#cross-module-integration)

When integrating with other modules, always use Service layer instead of direct Repository access:

```
// ✅ Correct - Use Service layer
$entityService->findEntityBy(['id' => $id]);

// ❌ Wrong - Direct Repository access violates architecture
$entityRepository->findOneBy(['id' => $id]);
```

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit packages/cms-bundle/tests
```

Requirements
------------

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+

Contributing
------------

[](#contributing)

Contributions are welcome! Please read our contributing guidelines and submit pull requests.

License
-------

[](#license)

MIT License

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance65

Regular maintenance activity

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

3

Last Release

330d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-cms-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-cms-bundle/health.svg)](https://phpackages.com/packages/tourze-cms-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
