PHPackages                             simplecms/dynamic\_unit - 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. simplecms/dynamic\_unit

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

simplecms/dynamic\_unit
=======================

动态单元组件，可以丰富你的Model，让其具备更多的单元属性，无需对数据表进行多次修改调整， 仅需要简单调用即可让单一Model增加更多可控属性

1.0.3(1y ago)010MITPHPPHP &gt;=8.2

Since Jul 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hackout/simplecms-dynamic_unit)[ Packagist](https://packagist.org/packages/simplecms/dynamic_unit)[ RSS](/packages/simplecms-dynamic-unit/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

SimpleCMS/Laravel Dynamic Unit Component
========================================

[](#simplecmslaravel-dynamic-unit-component)

📦 A dynamic unit component that combines the functionality of SKU and dict dictionary.

English | [简体中文](./README_zhCN.md)

[![Latest Stable Version](https://camo.githubusercontent.com/362a28a1588d8005826aa70d27f316a7ee80dbc0954e1a0aa1ccdd3298a61e1f/68747470733a2f2f706f7365722e707567782e6f72672f73696d706c65636d732f64796e616d69635f756e69742f762f737461626c652e737667)](https://packagist.org/packages/simplecms/dynamic_unit) [![Latest Unstable Version](https://camo.githubusercontent.com/176c2df0657ce7452a441b23eefadc0dcc74a90f13b7a93f3fcbd7d5bc3a4cf7/68747470733a2f2f706f7365722e707567782e6f72672f73696d706c65636d732f64796e616d69635f756e69742f762f756e737461626c652e737667)](https://packagist.org/packages/simplecms/dynamic_unit) [![Code Coverage](https://camo.githubusercontent.com/2ee8f0077642b1aa146386a539770cf2e2511f775b86b3c1122c447d4571565f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f766572747275652f656173792d736d732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/hackout/simplecms-dynamic_unit/?branch=master) [![Total Downloads](https://camo.githubusercontent.com/596d435011551370bcae526901ef0be8ede26a5c067f400ccf126bd632d5e103/68747470733a2f2f706f7365722e707567782e6f72672f73696d706c65636d732f64796e616d69635f756e69742f646f776e6c6f616473)](https://packagist.org/packages/simplecms/dynamic_unit) [![License](https://camo.githubusercontent.com/2a37fedb7f9296ba4a2ed5658ddd02dbb37cc19d13d7e0c5582571ee87857279/68747470733a2f2f706f7365722e707567782e6f72672f73696d706c65636d732f64796e616d69635f756e69742f6c6963656e7365)](https://packagist.org/packages/simplecms/dynamic_unit)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- MySql &gt;= 8.0
- [Laravel/Framework](https://packagist.org/packages/laravel/framework) &gt;= 11.0
- [SimpleCMS/Framework](https://packagist.org/packages/simplecms/framework) &gt;= 1.0

Installation
------------

[](#installation)

```
composer require simplecms/dynamic_unit
```

Usage
-----

[](#usage)

### Model Usage

[](#model-usage)

Use `DynamicAttributeTrait` to associate with the model.

```
use \SimpleCMS\DynamicUnit\Traits\DynamicAttributeTrait;
```

The model will automatically associate with the `customsAttributes` morphMany relationship

#### SCOPE

[](#scope)

Query model attributes values

```
$array = ['red','blue'];
$query->withAttributeCodes($array);
```

### Facades

[](#facades)

```
use SimpleCMS\DynamicUnit\Facades\DynamicUnit;
DynamicUnit::getAll(); //Get all parameters
DynamicUnit::findByCode(string $code); //Find by code
DynamicUnit::findListByCode(string $code); //Get attribute options
DynamicUnit::createUnit(array $array); //Create dynamic unit
DynamicUnit::updateUnit(int $id,array $array); //Update dynamic unit
DynamicUnit::deleteUnit(int $id); //Delete dynamic unit
DynamicUnit::createAttribute(array $array); //Create dynamic unit value
DynamicUnit::updateAttribute(int $id,array $array); //Update dynamic unit value
DynamicUnit::deleteAttribute(int $id); //Delete dynamic unit value
```

SimpleCMS Extension
-------------------

[](#simplecms-extension)

Please load `simplecms/framework` first.

### Service Calls

[](#service-calls)

```
use SimpleService;
//Add dynamic unit value query
$service->queryAttribute(array $codes)
```

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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 ~1 days

Total

3

Last Release

704d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9741288?v=4)[Dennis Lui](/maintainers/hackout)[@hackout](https://github.com/hackout)

---

Top Contributors

[![hackout](https://avatars.githubusercontent.com/u/9741288?v=4)](https://github.com/hackout "hackout (12 commits)")

---

Tags

laravelattributesSimpleCMSskudynamic\_unit

### Embed Badge

![Health badge](/badges/simplecms-dynamic-unit/health.svg)

```
[![Health](https://phpackages.com/badges/simplecms-dynamic-unit/health.svg)](https://phpackages.com/packages/simplecms-dynamic-unit)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[firefly-iii/data-importer

Firefly III Data Import Tool.

8015.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k30](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[vanilo/properties

Vanilo Properties (Attributes) Module

11153.7k3](/packages/vanilo-properties)

PHPackages © 2026

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