PHPackages                             biqiang/biphp-properties - 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. biqiang/biphp-properties

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

biqiang/biphp-properties
========================

为 PHP 提供属性管理扩展。

0.1.0(7y ago)112GPL-3.0-onlyPHP

Since Dec 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bi-qiang/BiphpProperties)[ Packagist](https://packagist.org/packages/biqiang/biphp-properties)[ RSS](/packages/biqiang-biphp-properties/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

为 PHP 类提供扩展的属性管理能力。

使用
--

[](#使用)

使用 `composer` 添加依赖 `composer require biqiang/biphp-properties`

在类中使用 `PropertyOwner` 并在 `specs` 方法中首先属性描述：

```
use Biphp\Properties\PropertyOwner;

class User
{
    use PropertyOwner;

    protected function specs(): array
    {
        return [
            'id'      => $this->IntegerSpec()->readOnly(),
            'name'    => $this->StringSpec(),
            'inviter' => $this->ObjectSpec()->setInstanceOf(User::class),
        ];
    }
}
```

访问定义的属性

```
$user = new User();

// 访问只读属性
echo $user->id;

// 访问可读写属性
$user->name = 'name';
echo $user->name;
```

特性列表
----

[](#特性列表)

- 为属性提供 `readOnly` 定义
- 提供属性 `manager` 定义，被定义为 `manager` 的类可以获得 `innerSet` 无视 `readOnly` 设置对属性进行修改。
- 为属性提供 `filter` 定义能力，在修改属性值前对输入值进行过滤。
- 为属性提供验证规则定义能力，在修改属性值前对输入值进行验证。
- 内置一些基础数据类型属性，提供对基础数据类型的输入检查。
- 提供属性修改监听，可以在属性被修改时执行一些回调操作。

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

2741d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9358967?v=4)[biqiang](/maintainers/biqiang)[@biqiang](https://github.com/biqiang)

---

Top Contributors

[![coderbiq](https://avatars.githubusercontent.com/u/717949?v=4)](https://github.com/coderbiq "coderbiq (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/biqiang-biphp-properties/health.svg)

```
[![Health](https://phpackages.com/badges/biqiang-biphp-properties/health.svg)](https://phpackages.com/packages/biqiang-biphp-properties)
```

###  Alternatives

[bluebaytravel/dosh

Simple currency formatter for PHP.

2120.8k](/packages/bluebaytravel-dosh)

PHPackages © 2026

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