PHPackages                             endou-mame/php-value-object - 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. endou-mame/php-value-object

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

endou-mame/php-value-object
===========================

📦 The PHP Value Object library offers immutable, type-safe, and self-validating objects to model domain values using the Value Object pattern.

v0.5.0(3mo ago)01MITPHPPHP &gt;=8.4CI passing

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/endou-mame/php-value-object)[ Packagist](https://packagist.org/packages/endou-mame/php-value-object)[ RSS](/packages/endou-mame-php-value-object/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

PHP Value Object
================

[](#php-value-object)

[![Packagist Version](https://camo.githubusercontent.com/c4fa25ee628cedb0ef2a19e6f95e9caf085d6f2457cd9ff84ae437a11c83fded/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e646f752d6d616d652f7068702d76616c75652d6f626a656374)](https://packagist.org/packages/endou-mame/php-value-object)[![PHP Version](https://camo.githubusercontent.com/4b67d49738029d500382229d36ac2b0b75e3d4ab1dd150d0810c11a45e2ad6c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f656e646f752d6d616d652f7068702d76616c75652d6f626a656374)](https://packagist.org/packages/endou-mame/php-value-object)[![PHPStan](https://github.com/endou-mame/php-value-object/actions/workflows/phpstan.yml/badge.svg)](https://github.com/endou-mame/php-value-object/actions/workflows/phpstan.yml)[![Documentation](https://github.com/endou-mame/php-value-object/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/endou-mame/php-value-object/actions/workflows/deploy-docs.yml)[![License](https://camo.githubusercontent.com/f31f9e6b8493b017767ce297d5798c098fb3d6143cf1828aee5fa34019e6bf8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e646f752d6d616d652f7068702d76616c75652d6f626a656374)](https://github.com/endou-mame/php-value-object/blob/main/LICENSE)

不変性、型安全性、自己検証を持つドメイン値オブジェクトを提供する PHP ライブラリです。

インストール
------

[](#インストール)

```
composer require endou-mame/php-value-object
```

使用例
---

[](#使用例)

### カスタム値オブジェクトの作成

[](#カスタム値オブジェクトの作成)

```
use EndouMame\PhpValueObject\String\StringValue;
use EndouMame\PhpValueObject\ValueObjectMeta;

#[ValueObjectMeta(name: '商品コード')]
final readonly class ProductCode extends StringValue
{
    protected static function minLength(): int { return 5; }
    protected static function maxLength(): int { return 5; }
    protected static function regex(): string { return '/^P[0-9]{4}$/'; }
}

$code = ProductCode::from('P1234');
```

### Result 型によるエラーハンドリング

[](#result-型によるエラーハンドリング)

```
use EndouMame\PhpMonad\Result;

$result = ProductCode::tryFrom('invalid');

$code = $result
    ->map(fn($code) => $code->value())
    ->unwrapOr('デフォルト');
```

ドキュメント
------

[](#ドキュメント)

詳細なガイドと API リファレンスは [ドキュメントサイト](https://endou-mame.github.io/php-value-object/) を参照してください。

要件
--

[](#要件)

- PHP 8.4 以上

ライセンス
-----

[](#ライセンス)

MIT License

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% 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

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b178ebfdb6cfb13043a0c5c82c1e64613777987ecb3083cffe6e300539429ca?d=identicon)[endou-mame](/maintainers/endou-mame)

---

Top Contributors

[![endou-mame](https://avatars.githubusercontent.com/u/87973394?v=4)](https://github.com/endou-mame "endou-mame (142 commits)")[![claude[bot]](https://avatars.githubusercontent.com/in/1236702?v=4)](https://github.com/claude[bot] "claude[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/endou-mame-php-value-object/health.svg)

```
[![Health](https://phpackages.com/badges/endou-mame-php-value-object/health.svg)](https://phpackages.com/packages/endou-mame-php-value-object)
```

PHPackages © 2026

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