PHPackages                             serendipity\_hq/php\_value\_objects - 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. [Database &amp; ORM](/categories/database)
4. /
5. serendipity\_hq/php\_value\_objects

Abandoned → [serendipity\_hq/component-value-objects](/?search=serendipity_hq%2Fcomponent-value-objects)ArchivedLibrary[Database &amp; ORM](/categories/database)

serendipity\_hq/php\_value\_objects
===================================

A set of value objects to manage simple and composite values

7.1.9(1y ago)216.3k1[6 issues](https://github.com/Aerendir/component-value-objects/issues)MITPHPPHP ^7.4|^8.0CI failing

Since Jul 18Pushed 1y agoCompare

[ Source](https://github.com/Aerendir/component-value-objects)[ Packagist](https://packagist.org/packages/serendipity_hq/php_value_objects)[ Docs](https://github.com/Aerendir/component-value-objects)[ RSS](/packages/serendipity-hq-php-value-objects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (19)Versions (88)Used By (0)

Warning

ARCHIVED
========

[](#archived)

After many years of honorable service, we have decided to archive this repository.

It has been extremely useful in many projects, but the time has come to archive it because it no longer makes sense to continue using it.

This was the first library we ever created: the emotional weight is considerable, and the decision has been extremely difficult.

However, we realized that there is no longer any point in maintaining it.

A post will follow with all the details, alternatives, and instructions on how you can replace this library in your projects.

 [ ![](https://camo.githubusercontent.com/5041251627a7ec1bf9335a20531d818d198f5315fc6e12d88c4694c9dcfd5bc7/687474703a2f2f7777772e736572656e64697069747968712e636f6d2f6173736574732f6f70656e2d736f757263652d70726f6a656374732f4c6f676f2d536572656e64697069747948512d49636f6e2d546578742d507572706c652e706e67) ](http://www.serendipityhq.com)

Serendipity HQ Value Objects
============================

[](#serendipity-hq-value-objects)

A set of [PHP Value Objects](https://io.serendipityhq.com/experience/php-and-doctrine-immutable-objects-value-objects-and-embeddables/) to manage simple and composite values.

 [![](https://camo.githubusercontent.com/0c076ff39375f673603f4bc9eccf7abb811e9a16b0fb4122aef68ca143234deb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736572656e6469706974795f68712f636f6d706f6e656e742d76616c75652d6f626a656374732e7376673f7374796c653d666c61742d737175617265)](https://github.com/Aerendir/component-value-objects/releases) [![](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT) [![](https://camo.githubusercontent.com/c7c6dba4b46be646a47d2e1db1fe5a01a74a0637fb6dd65fcb8c067db29e6680/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736572656e6469706974795f68712f636f6d706f6e656e742d76616c75652d6f626a656374733f636f6c6f723d253233383839324246267374796c653d666c61742d737175617265266c6f676f3d706870)](https://github.com/Aerendir/component-value-objects/releases)

 Supports: [![](https://camo.githubusercontent.com/152f8cb6191d2308b19e8962cbcefc2cf04a6606af6f40163c7ef74ba4499c63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545342e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^4.4")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^4.4") [![](https://camo.githubusercontent.com/eb005363bda440d1e5a2ba01ee729aac6471c5927ee5b89a9289ce09ab53fae8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545352e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^5.4")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^5.4") [![](https://camo.githubusercontent.com/5ff3e72a5cdb413dcb81412c452389b639e7797910635cfebb8104c1e696809c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e302d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^6.0")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^6.0")

 Tested with: [![](https://camo.githubusercontent.com/152f8cb6191d2308b19e8962cbcefc2cf04a6606af6f40163c7ef74ba4499c63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545342e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^4.4")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^4.4") [![](https://camo.githubusercontent.com/eb005363bda440d1e5a2ba01ee729aac6471c5927ee5b89a9289ce09ab53fae8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545352e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^5.4")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^5.4") [![](https://camo.githubusercontent.com/5ff3e72a5cdb413dcb81412c452389b639e7797910635cfebb8104c1e696809c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e302d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^6.0")](https://github.com/Aerendir/component-value-objects/actions "Tested with Symfony ^6.0")

 [![](https://camo.githubusercontent.com/0d1490a951396d9f7cc9b62b5f8b4432a5e22a9ebee5362333948895ca70c13b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d6578742d2d696e746c2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://www.php.net/manual/en/book.intl.php) [![](https://camo.githubusercontent.com/0009077794e71e9be7a6a3c474f4b54708ed3a4f039410482a06803c8887ec6c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d646f637472696e652f6f726d2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://www.doctrine-project.org/) [![](https://camo.githubusercontent.com/896286af0b613482084ccd808a38e63af792f934c704f59866299cb7d1c6fa53/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d73796d666f6e792f666f726d2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://symfony.com/doc/current/forms.html) [![](https://camo.githubusercontent.com/b51cdeab78edc040fcc85b3a85039c0fbee8f4cc2897e6364a23c6c39f5279ce/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d747769672f696e746c2d2d65787472612d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://github.com/twigphp/intl-extra)

Current Status
--------------

[](#current-status)

[![Coverage](https://camo.githubusercontent.com/9d9c3d3b011c4ee7e1ecf25410441325b2fc36c9c4b6ce3eafe5a10b65f64053/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d636f766572616765)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Maintainability Rating](https://camo.githubusercontent.com/cb2d7fe01c346e173e4cb31448b4158fdf0fcdd6f2667ad3519da29097f3a73a/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Quality Gate Status](https://camo.githubusercontent.com/93331f1a023fd5f070758715cf41186c24739122e01ce636113c65ace3fb154e/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Reliability Rating](https://camo.githubusercontent.com/ab9ece338573ac265870668a6504cb2e79ac9aab0242696b29716d16c2532aa3/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Security Rating](https://camo.githubusercontent.com/3c250f7099c06bf7a544727d583eab07369e880ff9ba10af5a7458b6d948c09f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Technical Debt](https://camo.githubusercontent.com/6beb7be741c862808ddcf08344566b8f41a26035a32b7ccedd45ef4e187890bf/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d7371616c655f696e646578)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)[![Vulnerabilities](https://camo.githubusercontent.com/dd081184adfc8321d63d0ba0d1c7d2a21bf4ef3f5a6c2ab56b2d7328932856e0/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d76616c75652d6f626a65637473266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/dashboard?id=Aerendir_component-value-objects)

[![Phan](https://github.com/Aerendir/component-value-objects/workflows/Phan/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![PHPStan](https://github.com/Aerendir/component-value-objects/workflows/PHPStan/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![PSalm](https://github.com/Aerendir/component-value-objects/workflows/PSalm/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![PHPUnit](https://github.com/Aerendir/component-value-objects/workflows/PHPunit/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![Composer](https://github.com/Aerendir/component-value-objects/workflows/Composer/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![PHP CS Fixer](https://github.com/Aerendir/component-value-objects/workflows/PHP%20CS%20Fixer/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)[![Rector](https://github.com/Aerendir/component-value-objects/workflows/Rector/badge.svg)](https://github.com/Aerendir/component-value-objects/actions?query=branch%3Adev)

Features
--------

[](#features)

It supports `SimpleValueObjects` and `ComplexValueObjects`.

Complex value objects are hydrated passing an array. If a key of the array isn't recognized as property of the object it is added to the `$otherData` array so it isn't lost.

Some of those value objects support also the persistence in Doctrine providing [custom mapping types](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/custom-mapping-types.html) (See below).

---

###  **Do you like this library?**
 **[LEAVE A ★](#js-repo-pjax-container)**

[](#----do-you-like-this-library----leave-a-)

 or run
 `composer global require symfony/thanks && composer thanks`
 to say thank you to all libraries you use in your current project, this included!

---

What are Value Objects
----------------------

[](#what-are-value-objects)

Value Objects are PHP [`objects`](http://php.net/manual/en/language.types.object.php) that represent and manage simple or complex values. Once set, the value object cannot be modified without changing its identity.

**Simple value objects** represent a simple value, like an email. **Complex value objects** represent complex values, that, in order to really represent a value, need more than one value, like a price that needs an amount and a currency to be understandable and have a sense.

PHP supports only one value object: the [`DateTime`](http://php.net/manual/en/class.datetime.php) object.

This library gives support for other kind of values, differentiating them between complex and simple.

To better understand the concepts behind the value objects, you can [read this post](https://io.serendipityhq.com/experience/php-and-doctrine-immutable-objects-value-objects-and-embeddables/).

Install component-value-objects via Composer
--------------------------------------------

[](#install-component-value-objects-via-composer)

```
$ composer require serendipity_hq/component-value-objects

```

This library follows the  versioning conventions.

[Instructions to install Intl PHP extension in MAMP for Mac](https://io.serendipityhq.com/experience/how-to-install-php-intl-module-in-mamp/)

Available Value Objects
-----------------------

[](#available-value-objects)

Currently, this library supports the following Value Objects:

- **[Address](docs/Address.md)**: Built-in. A more advanced value object is [`commerceguys/addressing`](https://github.com/commerceguys/addressing) (but it more suited for shipping addresses than for addresses themself);
- **[CurrencyExchangeRate](docs/CurrencyExchangeRate.md)**: Built-in;
- **[Email](docs/Email.md)**: A basic class derived from [Wowo's gist EmailValueObject](https://gist.github.com/wowo/b49ac45b975d5c489214). It implements [`egulias/email-validator](https://github.com/egulias/EmailValidator) to validate emails;
- **[IP](docs/Ip.md)**: Just a proxy for the library [`darsyn/ip`](https://github.com/darsyn/ip);
- **[Money](docs/Money.md)**: Just a proxy for the library [`moneyphp/money`](https://github.com/moneyphp/money);
- **[Payment](docs/Payment.md)**: Built-in
- **[Phone](docs/Phone.md)**: Just a proxy for the library [`giggsey/libphonenumber-for-php`](https://github.com/giggsey/libphonenumber-for-php);
- **[Tax](docs/Tax.md)**: Built-in
- **[Uri](docs/Uri.md)**: Just a proxy for the library [`Laminas\Uri`](https://github.com/laminas/laminas-uri) (formerly Zend Uri). A more advanced value object is [`League\Uri`](https://github.com/thephpleague/uri)
- **[VatRate](docs/Vat.md)**: Built-in
- **[VatNumber](docs/VatNumber.md)**: Built-in

Supported features
------------------

[](#supported-features)

   ValueObject Doctrine Symfony    Embeddable Type Form Type Twig filter     Address ✓ ✕ ✓ ✕   Currency N/A ✓ ✕ ✕   CurrencyExchangeRate N/A N/A N/A N/A   Email N/A ✓ N/A N/A   IP N/A N/A N/A N/A   Money N/A ✓ ✓ ✓   Payment ✕ ✕ ✕ ✕   Phone ✕ ✕ ✕ ✕   Tax ✕ ✕ ✕ ✕   Uri ✕ ✓ ✕ ✕   VAT Rate ✕ ✕ ✕ ✕   VAT Number ✕ ✕ ✕ ✕  ---

###  **Do you like this library?**
 **[LEAVE A ★](#js-repo-pjax-container)**

[](#----do-you-like-this-library----leave-a--1)

 or run
 `composer global require symfony/thanks && composer thanks`
 to say thank you to all libraries you use in your current project, this included!

---

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance41

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~92 days

Total

87

Last Release

425d ago

Major Versions

2.7.0 → 3.0.02016-11-01

3.1.3 → 4.0.02017-09-26

4.0.11 → 5.0.02020-01-17

5.0.7 → 6.0.02020-07-10

6.0.0 → 7.0.02020-09-07

PHP version history (7 changes)1.0.0PHP ^5.6|^7.0

1.0.4PHP ^5.4|^7.0

4.0.0PHP ^7.1

5.0.0PHP ^7.2

7.0.0PHP ^7.3

7.1.0PHP ^7.3|^8.0

7.1.2PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd91a553e180dea3a2e726643704e33a1d7e4c818b65ead1516ddf2f4e23ea43?d=identicon)[Aerendir](/maintainers/Aerendir)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (642 commits)")[![Aerendir](https://avatars.githubusercontent.com/u/1968622?v=4)](https://github.com/Aerendir "Aerendir (606 commits)")[![kodiakhq[bot]](https://avatars.githubusercontent.com/in/29196?v=4)](https://github.com/kodiakhq[bot] "kodiakhq[bot] (556 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (9 commits)")[![Big-Shark](https://avatars.githubusercontent.com/u/646054?v=4)](https://github.com/Big-Shark "Big-Shark (1 commits)")[![leonardofalanga](https://avatars.githubusercontent.com/u/20907369?v=4)](https://github.com/leonardofalanga "leonardofalanga (1 commits)")

---

Tags

doctrinephpvalue-objectvalue objects

###  Code Quality

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/serendipity-hq-php-value-objects/health.svg)

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

###  Alternatives

[serendipity_hq/component-value-objects

A set of value objects to manage simple and composite values

20558.6k4](/packages/serendipity-hq-component-value-objects)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

9230.2k4](/packages/bitrix24-b24phpsdk)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)[scottlaurent/accounting

Laravel Accounting Journals for Eloquent Models

20251.8k](/packages/scottlaurent-accounting)[michaelgooden/mdg-money-doctrine

Doctrine Types and Embeddables for the PHP implementation of Fowler's Money pattern.

16260.6k](/packages/michaelgooden-mdg-money-doctrine)

PHPackages © 2026

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