PHPackages                             dagasmart/dict - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dagasmart/dict

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dagasmart/dict
==============

bizAdmin 数据字典扩展

1.0.3(12mo ago)00MITPHPPHP &gt;=8.0

Since May 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/dagasmart/dict)[ Packagist](https://packagist.org/packages/dagasmart/dict)[ Docs](https://github.com/dagasmart/dict)[ RSS](/packages/dagasmart-dict/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

BizAdmin 数据字典
-------------

[](#bizadmin-数据字典)

效果
--

[](#效果)

增加数据字典管理功能

安装
--

[](#安装)

#### composer

[](#composer)

```
composer require dagasmart/dict
```

使用说明
----

[](#使用说明)

1. 安装扩展
2. 在扩展管理中启用扩展

使用方法
----

[](#使用方法)

### 配置

[](#配置)

在扩展管理中可以配置以下内容

- 屏蔽数据字典类型管理
- 屏蔽数据字典创建
- 屏蔽数据字典删除

### 调用

[](#调用)

```
// 使用助手函数
admin_dict()->get('data.filesystem.driver');
//输出：['data' => ['local' => ['key' => 'local', 'value' => '本地存储'], ...]]
admin_dict()->getAll('data.filesystem.driver');
//输出：['local' => ['key' => 'local', 'value' => '本地存储'], ...]
admin_dict()->getKey('data.filesystem.driver');
//输出：['local', ...]
admin_dict()->getKey('data.filesystem.driver','本地存储');
//输出：local
admin_dict()->getValue('data.filesystem.driver');
//输出：['本地存储', ...]
admin_dict()->getValue('data.filesystem.driver', 'local');
//输出：本地存储
admin_dict()->getOptions('data.filesystem.driver');
//输出：[['label' => '本地存储', 'value' => 'local'], ...]
admin_dict()->getMapValues('data.filesystem.driver');
//输出：["本地存储", ...]

// 使用接口获取字典选项 (暂时不以使用，该接口会返回 [['label' => xx, 'value' => xx]] 格式的数据)
api('/basic/dict/options?path=data.filesystem.driver')
```

### 可用方法

[](#可用方法)

```
/**
 * 获取数据字典值
 * @params string $path 路径 例如: user.status
 * @params string $default 默认值
 * @params bool $needAllData 是否需要返回所有数据 (为true时返回所有数据, 包括禁用数据和软删除数据)
 * @return string 例如: 正常
 */
public function getValue($path, $default = '', $needAllData = true)

/**
 * 获取数据字典键
 * @params ...
 * @return string 例如: normal
 */
public function getKey($path, $default = '', $needAllData = true)

/**
 * 获取数据字典数据
 * @params ...
 * @return array 例如: ['key' => 'normal', 'value' => '正常']
 */
public function getAll($path, $default = [], $needAllData = true)

/**
 * 获取数据字典数据 - 选项格式
 * @params ...
 * @return array 例如: [['label' => '正常', 'value' => 'normal']]
 */
public function getOptions($path, $needAllData = true)
```

### 注意事项

[](#注意事项)

数据字典数据做了缓存, 新增或修改时会自动清理缓存
直接修改数据库数据字典表数据, 请手动清除缓存

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance66

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

364d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a04a439041bd34c826a8cbfe7e2198c35a2106f74703cd1bec9710655905007?d=identicon)[dagasmart](/maintainers/dagasmart)

---

Top Contributors

[![dagasmart](https://avatars.githubusercontent.com/u/170431844?v=4)](https://github.com/dagasmart "dagasmart (1 commits)")

---

Tags

extensionDictbizadmin

### Embed Badge

![Health badge](/badges/dagasmart-dict/health.svg)

```
[![Health](https://phpackages.com/badges/dagasmart-dict/health.svg)](https://phpackages.com/packages/dagasmart-dict)
```

###  Alternatives

[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
