wbraganca/yii2-enumerables
Composer 安装命令:
composer require wbraganca/yii2-enumerables
包简介
An enumeration implementation to yii2 framework.
README 文档
README
An enumeration implementation to yii2 framework.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist wbraganca/yii2-enumerables "*"
or add
"wbraganca/yii2-enumerables": "*"
to the require section of your composer.json file.
Usage
####EnumBoolean
Generates a boolean array. You can pass the false label (default No) and true label (default Yes).
use wbraganca\enumerables\EnumBoolean;
var_dump(EnumBoolean::getConstList());
array(2) {
[0] => string(2) "No"
[1] => string(3) "Yes"
}
EnumBoolean::getConstList('Inactive', 'Active');
array(2) {
[0] => string(8) "Inactive"
[1] => string(6) "Active"
}
####EnumYear
Generates an array of years between from and to years. Years till current system date will be generated if to year is not specified.
use wbraganca\enumerables\EnumYear;
EnumYear::getConstList(2015, 2000)
array(16) {
[2015] => int(2015)
[2014] => int(2014)
[2013] => int(2013)
[2012] => int(2012)
[2011] => int(2011)
[2010] => int(2010)
[2009] => int(2009)
[2008] => int(2008)
[2007] => int(2007)
[2006] => int(2006)
[2005] => int(2005)
[2004] => int(2004)
[2003] => int(2003)
[2002] => int(2002)
[2001] => int(2001)
[2000] => int(2000)
}
EnumYear::getConstList(2000, 2015)
array(16) {
[2000] => int(2000)
[2001] => int(2001)
[2002] => int(2002)
[2003] => int(2003)
[2004] => int(2004)
[2005] => int(2005)
[2006] => int(2006)
[2007] => int(2007)
[2008] => int(2008)
[2009] => int(2009)
[2010] => int(2010)
[2011] => int(2011)
[2012] => int(2012)
[2013] => int(2013)
[2014] => int(2014)
[2015] => int(2015)
}
####EnumMonth
Generates an array of months.
use wbraganca\enumerables\EnumMonth;
EnumMonth::getConstList()
array(12) {
[1] => 'January'
[2] => 'February'
[3] => 'March'
[4] => 'April'
[5] => 'May'
[6] => 'June'
[7] => 'July'
[8] => 'August'
[9] => 'September'
[10] => 'October'
[11] => 'November'
[12] => 'December'
}
EnumMonth::getConstList(['abbr' => true, 'case' => 'upper'])
array(12) {
[1] => 'JAN'
[2] => 'FEB'
[3] => 'MAR'
[4] => 'APR'
[5] => 'MAY'
[6] => 'JUN'
[7] => 'JUL'
[8] => 'AUG'
[9] => 'SEP'
[10] => 'OCT'
[11] => 'NOV'
[12] => 'DEC'
}
EnumMonth::getLabel(EnumMonth::JANUARY);
string(7) "January"
EnumMonth::getLabel(1, ['abbr' => true, 'case' => 'upper']);
string(3) "JAN"
EnumMonth::getLabel(1, ['case' => 'lower']);
string(7) "january"
####EnumDay
Generates an array of days.
use wbraganca\enumerables\EnumDay;
EnumDay::getConstList()
array(7) {
[1] => 'Sunday'
[2] => 'Monday'
[3] => 'Tuesday'
[4] => 'Wednesday'
[5] => 'Thursday'
[6] => 'Friday'
[7] => 'Saturday'
}
EnumDay::getConstList(['abbr' => true, 'case' => 'upper'])
array(7) {
[1] => 'SUN'
[2] => 'MON'
[3] => 'TUE'
[4] => 'WED'
[5] => 'THU'
[6] => 'FRI'
[7] => 'SAT'
}
EnumDay::getLabel(EnumDay::MONDAY);
string(6) "Monday"
EnumDay::getLabel(7, ['abbr' => true, 'case' => 'upper']);
string(3) "SAT"
EnumDay::getLabel(7, ['abbr' => true, 'case' => 'lower']);
string(3) "sat"
wbraganca/yii2-enumerables 适用场景与选型建议
wbraganca/yii2-enumerables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.12k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「wbraganca」 「yii2-enumerables」 「yii2-enum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wbraganca/yii2-enumerables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wbraganca/yii2-enumerables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wbraganca/yii2-enumerables 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The yii2-multiselect is a Yii 2 wrapper for [Bootstrap Multiselect](http://davidstutz.github.io/bootstrap-multiselect/).
A custom URL rule class for Yii 2 which allows to create translated URL rules
It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Locates an address in Brazil by postal code
统计信息
- 总下载量: 3.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-07-18