承接 jbsnewmedia/ddm-bundle 相关项目开发

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

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

jbsnewmedia/ddm-bundle

Composer 安装命令:

composer require jbsnewmedia/ddm-bundle

包简介

Data Definition Model Bundle for VIS

README 文档

README

Packagist Version Packagist Downloads PHP Version Require Symfony Version License Tests PHP CS Fixer PHPStan Rector codecov

DDMBundle (Data Definition Model) is a Symfony bundle for the VIS ecosystem that simplifies the definition and handling of data models for datatables and forms. It provides a structured way to centrally define fields, validations, and rendering logic.

🚀 Features

  • Centralized Data Definition via DDM and DDMField
  • Automated Datatable Engine for server-side processing (sorting, searching, pagination)
  • Advanced Search Functionality via DDMDatatableSearchHandler
  • Flexible Form Handler for AJAX-based form processing and validation
  • Attribute-based Field Configuration for easy integration into entities
  • Extensive Validation (Required, String, Unique, Email, etc.)
  • Twig Integration for easy rendering of forms and tables
  • Seamless Integration into the VIS ecosystem

⚙️ Requirements

  • PHP 8.2 or higher
  • Symfony Framework 7.4 or higher
  • Doctrine ORM

📦 Installation

Use Composer to install the bundle:

composer require jbsnewmedia/ddm-bundle

🛠 Setup & Configuration

1. Define Fields

Fields are defined as services and can be configured with the #[DDMFieldAttribute] attribute to associate them with specific entities or contexts. In the __construct method or via initialization, field properties such as identifier, name, and behavior can be set.

use JBSNewMedia\DDMBundle\Attribute\DDMFieldAttribute;
use JBSNewMedia\DDMBundle\Service\DDMField;

#[DDMFieldAttribute(entity: 'User', order: 10)]
class UserNameField extends DDMField
{
    public function __construct()
    {
        $this->setIdentifier('username');
        $this->setName('Username');
        $this->setSortable(true);
        $this->setLivesearch(true);
    }
}

2. Create DDM Instance

Use the DDMFactory to create a DDM instance for an entity and a context:

use JBSNewMedia\DDMBundle\Service\DDMFactory;

public function index(DDMFactory $ddmFactory)
{
    $ddm = $ddmFactory->create(User::class, 'admin_list');
    // ...
}

📋 Usage Examples

Using Datatable in a Controller

The DDMDatatableEngine handles all the logic for providing the data:

use JBSNewMedia\DDMBundle\Service\DDMDatatableEngine;
use JBSNewMedia\DDMBundle\Service\DDMFactory;
use Symfony\Component\HttpFoundation\Request;

public function list(Request $request, DDMFactory $ddmFactory, DDMDatatableEngine $engine)
{
    $ddm = $ddmFactory->create(User::class, 'list');
    
    if ($request->isXmlHttpRequest()) {
        return $engine->handleRequest($request, $ddm);
    }
    
    return $this->render('user/list.html.twig', [
        'ddm' => $ddm
    ]);
}

Processing a Form

The DDMDatatableFormHandler automates loading, validating, and saving entities. It returns either a rendered form or a JSON response.

use JBSNewMedia\DDMBundle\Service\DDMDatatableFormHandler;
use Symfony\Component\HttpFoundation\Response;

public function edit(Request $request, User $user, DDMDatatableFormHandler $formHandler)
{
    $ddm = $this->ddmFactory->create(User::class, 'edit');
    
    $response = $formHandler->handle($request, $ddm, $user);
    
    return $response;
}

🎨 Template Integration

Datatable Rendering

<div id="user-datatable" 
     data-avalynx-datatable-url="{{ path('user_list_ajax') }}"
     data-avalynx-datatable-config="{{ ddm.datatableConfig|json_encode }}">
    <!-- The engine provides data suitable for AvalynX Datatable -->
</div>

📁 Architecture Overview

Core Components

src/
├── Attribute/           # PHP Attributes for field configuration
├── Contract/            # Interfaces for fields, validators and values
├── DependencyInjection/ # Bundle configuration & extension
├── Doctrine/            # Doctrine-specific extensions (e.g. CAST function)
├── Service/
│   ├── DDM.php              # Central model of a data definition
│   ├── DDMFactory.php       # Factory for creating DDM instances
│   ├── DDMField.php         # Base class for all fields
│   ├── DDMDatatableEngine.php # Engine for datatable requests
│   ├── DDMDatatableFormHandler.php # Handler for form logic
│   └── DDMDatatableSearchHandler.php # Handler for datatable search
├── Trait/               # Shared functionalities (e.g. entity access)
├── Validator/           # Validators (Required, String, Unique, Email, etc.)
├── Value/               # Value objects (String, Array, etc.)
└── DDMBundle.php        # Bundle class

🧪 Developer Tools

The following commands are available for development:

# Tool installation
composer bin-ecs-install
composer bin-phpstan-install
composer bin-phpunit-install
composer bin-rector-install

# Code quality checks
composer bin-ecs           # PHP-CS-Fixer check
composer bin-phpstan       # Static analysis
composer bin-rector        # Code transformation (dry-run)
composer test              # PHPUnit tests

# Automatic fixes
composer bin-ecs-fix       # Fix coding standards
composer bin-rector-process # Apply code transformation

# CI Pipelines
composer ci                # Execute all checks

📜 License

This bundle is licensed under the MIT License. See the LICENSE file for more details.

Developed by Jürgen Schwind and other contributors.

🤝 Contributing

Contributions are welcome! If you would like to contribute, please create a pull request or open an issue.

📫 Contact

If you have questions or problems, please open an issue in our GitHub repository.

Data Definition Model. Modular. Efficient. VIS-Ready.

jbsnewmedia/ddm-bundle 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-28