承接 dereuromark/cakephp-dto 相关项目开发

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

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

dereuromark/cakephp-dto

最新稳定版本:2.5.1

Composer 安装命令:

composer require dereuromark/cakephp-dto

包简介

CakePHP DTO Plugin

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.

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 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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固