sinevia/laravel-entity
Composer 安装命令:
composer require sinevia/laravel-entity
包简介
A streamlined EAV implementation for Laravel
README 文档
README
Cool schemaless models for Laravel.
Details
A streamlined entity-attribute-value (EAV) implementation for Laravel. This package is designed for quick plug and play "schemeless" prototyping. To achieve this the package uses only two database tables unlike the standard EAV (which uses at least three tables).
Features
- Schemaless implementation with 2 database tables only.
- Entitiies have types. Each type is like a class (i.e. note, category, etc)
- Entitiies may have unlimited fields. Fields can have any value (string, int, float, array)
- Entitiies may have hierarchy (parent and children). Great when you have categories, or paths
- Ideal for quick prototyping
- Uses human friendly IDs (see https://github.com/Sinevia/php-library-uid)
Installation
composer require sinevia/laravel-entity
How to Use
// 1. Create your model class class Note extends \Sinevia\Entities\Models\Entity { function getType() { return 'note'; } } // 2. Create new instance and add fields $note = new Note(); $note->save(); $note->setFieldValue('Title','Note title'); $note->setFieldValue('Text','Note text'); // 3. Create new instance and add fields $note = Note::find($noteId); echo $note->getFieldValue('Title'); echo $note->getFieldValue('Text'); // 4. Iterate throuhh all notes $note = Note::all(); foreach($notes as $note){ echo $note->getFieldValue('Title'); }
Table Schema
The following schema is used for the database.
| Entity | |
|---|---|
| Id | String, UniqueId |
| Status | String |
| Type | String |
| ParentId | String, UniqueId |
| Sequence | Integer |
| Name | String |
| CreatedAt | DateTime |
| DeletedAt | DateTime |
| Udated At | DateTime |
| Field | |
|---|---|
| Id | String, UniqueId |
| EntityId | String, UniqueId |
| Key | String |
| Value | JSON Text (Long) |
| CreatedAt | DateTime |
| DeletedAt | DateTime |
| UpdatedAt | DateTime |
sinevia/laravel-entity 适用场景与选型建议
sinevia/laravel-entity 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 277 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「eav」 「entity」 「sinevia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sinevia/laravel-entity 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sinevia/laravel-entity 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sinevia/laravel-entity 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Runn Me! Value Objects Library
EAV modeling package for Eloquent and Laravel.
generates php entities from openapi spec
DCSDynamicDiscriminatorMapBundle simplifies the use of Doctrine Single Table Inheritance mapping strategy in Symfony2.
swoft 2.0 entity creater
PhpPlaisio: Core Entity Lock
统计信息
- 总下载量: 277
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2018-07-04