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

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

endoumame/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(4mo ago)00MITPHPPHP &gt;=8.4CI passing

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/endoumame/php-value-object)[ Packagist](https://packagist.org/packages/endoumame/php-value-object)[ RSS](/packages/endoumame-php-value-object/feed)WikiDiscussions main Synced 3w ago

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

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

[](#php-value-object)

[![Packagist Version](https://camo.githubusercontent.com/061b4248806c7b36e6857207eb11ddb97a36ea546f6175e91e4cc1cd88ad1698/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e646f756d616d652f7068702d76616c75652d6f626a656374)](https://packagist.org/packages/endoumame/php-value-object)[![PHP Version](https://camo.githubusercontent.com/4c085d4a92c0e095c6463abc3041f3c24e9aded7ca1ef1e26585f3329c3eb0e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f656e646f756d616d652f7068702d76616c75652d6f626a656374)](https://packagist.org/packages/endoumame/php-value-object)[![PHPStan](https://github.com/endoumame/php-value-object/actions/workflows/phpstan.yml/badge.svg)](https://github.com/endoumame/php-value-object/actions/workflows/phpstan.yml)[![Documentation](https://github.com/endoumame/php-value-object/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/endoumame/php-value-object/actions/workflows/deploy-docs.yml)[![License](https://camo.githubusercontent.com/ce2dac32e5b1e460be411cdd8e13be0852ef024ecbfbbf294af392f598d64784/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e646f756d616d652f7068702d76616c75652d6f626a656374)](https://github.com/endoumame/php-value-object/blob/main/LICENSE)

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

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

[](#インストール)

```
composer require endoumame/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://endoumame.github.io/php-value-object/) を参照してください。

要件
--

[](#要件)

- PHP 8.4 以上

ライセンス
-----

[](#ライセンス)

MIT License

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance79

Regular maintenance activity

Popularity0

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

127d ago

### Community

Maintainers

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

---

Top Contributors

[![endoumame](https://avatars.githubusercontent.com/u/87973394?v=4)](https://github.com/endoumame "endoumame (143 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/endoumame-php-value-object/health.svg)

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

PHPackages © 2026

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