定制 dereuromark/cakephp-dto 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dereuromark/cakephp-dto

Composer 安装命令:

composer require dereuromark/cakephp-dto

包简介

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

README 文档

README

CI codecov Latest Stable Version Minimum PHP Version License Total Downloads Coding Standards

A Data Transfer Object (DTO) is an object used to pass typed data between layers in your application, similar in concept to Structs in C, Martin Fowler's Transfer Objects, or Value Objects.

The goal of this package is to structure "unstructured data", replacing simple (associative) arrays with a more speaking solution.

Unique approach: Unlike other PHP DTO libraries that use runtime reflection, this plugin generates actual PHP code from configuration files. This provides the best possible IDE support, static analysis compatibility, and runtime performance. See Motivation for a comparison with alternatives.

  • By making all fields typeable, we can be sure that their values are never something we didn't expect. Especially with modern PHP and more strict typehinting moving forward this is rather important to detect and fail early.
  • We can have full IDE autocomplete and typehinting.
  • We can use tools like PHPStan to statically analyze the code (more strictly).
  • We can simplify the logic where required fields will now just throw a meaningful exception.
  • We can work with different inflections of field names more easily.
  • Easy way of immutable DTOs with required fields, to trust them in following code.
  • Works out of the box with any value object that is serializable (either as array or string).

This plugin will provide you with a tool to quickly generate custom and optimized DTOs for your special use cases.

CakePHP integration for php-collective/dto.

This branch is for use with CakePHP 5.1+. For details see version map.

Examples

Live examples in the Sandbox: Github Demo.

See Examples for basic, immutable, mapper, and complex entity use cases. The generated demo DTOs of those are in tests/test_app/src/Dto/.

Note: Param/return types are enabled and strict types disabled by default.

Installation

You can install this plugin into your CakePHP application using Composer.

composer require dereuromark/cakephp-dto

Then load the plugin with the following command:

bin/cake plugin load CakeDto

Usage

See Docs for details.

dereuromark/cakephp-dto 适用场景与选型建议

dereuromark/cakephp-dto 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98.09k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2018 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 dereuromark/cakephp-dto 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 98.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 30
  • 点击次数: 32
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 30
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-08