定制 jose-chan/entity-utils 二次开发

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

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

jose-chan/entity-utils

最新稳定版本:v2.0.2

Composer 安装命令:

composer require jose-chan/entity-utils

包简介

README 文档

README

composer require "jose-chan/entity-utils"

laravel中使用

<?php

$data = [
    "a" => 1,
    "b" => "b",
    "c" => [
        "d" => 1.22,
        "e" => ""
    ],
    "d" => [
        [
            "f" => "f",
            "g" => 4
        ],
        [
            "f" => "f",
            "g" => 4
        ]
    ]
];

$entity = app(\JoseChan\Entity\Entity::class, ["data" => $data]);

指定对象类型

<?php

class CEntity extends JoseChan\Entity\Entity{
    
}

class MyEntity extends \JoseChan\Entity\Entity {
    
    protected $arrayAttributeEntity = [
        "c" => CEntity::class
    ];
}

指定二维数组用的Collection

<?php

class MyCollection extends \Illuminate\Support\Collection{
    
}

class DEntity extends \JoseChan\Entity\Entity{
    
    protected static function collection(){
        return MyCollection::class;
    }
}

使用自动校验数组

<?php
class MyValidateEntity extends \JoseChan\Entity\ValidateEntity{
    protected function rules(){
        return [
            "a" => "required"    
        ];
    }
    
    protected function messages(){
        return [
            "a.required" => "a属性必须存在"    
        ];
    }
    
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固