mohsentm/laravel-db-enum
Composer 安装命令:
composer require mohsentm/laravel-db-enum
包简介
laravel-db-enum is a trait for laravel models. use this trait on modules for getting the table fileds enum values
README 文档
README
laravel-db-enum is a trait for laravel models. use this trait on modules for getting the table fileds enum values.
tags: laravel, lumen, eloquent, enum field
Installing
Pull this package via Composer.
{ "require": { "mohsentm/laravel-db-enum": "^1.*" } }
or run in terminal:
composer require mohsentm/laravel-db-enum
Usage
use this trait use Mohsentm\EnumValue; your the model.
namespace App; use Illuminate\Database\Eloquent\Model; use Mohsentm\EnumValue; class TestModal extends Model { protected $table = "test"; //Get enum value trait use EnumValue; }
then use getEnumValues() function to get enum values
namespace App\Http\Controllers; use Illuminate\Http\Request; use App\TestModal; class TestController extends Controller { public function index(){ //return the array of table enum value list return TestModal::getEnumValues(); } }
result
{"user_status":["enable","disable"]}
Cache
To have best performance this package cache the result.
Contribute
Would you like to help with this project? Great! You don't have to be a developer, either. If you've found a bug or have an idea for an improvement, please open an issue and tell us about it.
If you are a developer wanting contribute an enhancement, bug fix or other patch to this project, please fork this repository and submit a pull request detailing your changes. We review all PRs! This open source project is released under the Apache 2.0 license which means if you would like to use this project's code in your own project you are free to do so. Speaking of, if you have used our code in a cool new project we would like to hear about it! Please send us an email.
License
Please refer to the LICENSE file that came with this project.
mohsentm/laravel-db-enum 适用场景与选型建议
mohsentm/laravel-db-enum 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.12k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 12 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「db」 「enum」 「laravel」 「table」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mohsentm/laravel-db-enum 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mohsentm/laravel-db-enum 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mohsentm/laravel-db-enum 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Enum type behavior for Yii2 based on class constants
Store your language lines in the database, yaml or other sources
A PHP Abstract Enum Class
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Compatibility layer for emulating enumerations in PHP < 8.1 and native enumerations in PHP >= 8.1
统计信息
- 总下载量: 3.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-12-01