PHPackages                             jgimeno/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jgimeno/value-objects

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

jgimeno/value-objects
=====================

Collection of PHP value objects to use and extend as building blocks for DDD.

0.3.0(9y ago)73301[3 issues](https://github.com/jgimeno/value-objects/issues)MITPHPPHP &gt;=7.0

Since Feb 14Pushed 9y agoCompare

[ Source](https://github.com/jgimeno/value-objects)[ Packagist](https://packagist.org/packages/jgimeno/value-objects)[ RSS](/packages/jgimeno-value-objects/feed)WikiDiscussions master Synced 4w ago

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

[![Build Status](https://camo.githubusercontent.com/5f3e0601559766cdd193159d00e05e79ad532887ae65b6ec5221e2ef02a5252b/68747470733a2f2f7472617669732d63692e6f72672f6a67696d656e6f2f76616c75652d6f626a656374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jgimeno/value-objects)[![Coverage Status](https://camo.githubusercontent.com/7b4c76b2ab13ce088613a084f51140fc261bce77d7d6718d2c6263c991397e61/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a67696d656e6f2f76616c75652d6f626a656374732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/jgimeno/value-objects?branch=master)[![Code Climate](https://camo.githubusercontent.com/75a2a46ffd7dab8f63e3630cb7c244716c8ad9e399c681ef6abc55cc4d062d2c/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a67696d656e6f2f76616c75652d6f626a656374732f6261646765732f6770612e737667)](https://codeclimate.com/github/jgimeno/value-objects)

Ultimate PHP Value Object Collection
====================================

[](#ultimate-php-value-object-collection)

Collection of PHP value objects to use and extend as building blocks for DDD.

This library comes with the idea of having a starting point for defining value objects for different projects.

All the value objects are inmutable.

How to install
--------------

[](#how-to-install)

You can get it using composer:

```
composer require jgimeno/value-objects

```

How to use
----------

[](#how-to-use)

### Base objects

[](#base-objects)

The idea of this library is to have a collection of objects as a base for the creation of your Domain.

The most basic object is the `ValueObject` which we can extend all the value objects we want to create from. Base `ValueObject` implements `__toString()` and `equals()` methods (i.e. you get them for free).

If we know that our value objects will benefit from the methods included in the objects `Strings`, `Number` or `Boolean`, we can extend from there.

### Rationale

[](#rationale)

Imagine that I create an object called `SonName` that our domain needs. In that case it could be useful to extend from `Strings` and we will have methods like `toUpperCase()`, `trim()`, etc that we can reuse. You get the idea.

Lastly there is another base object called `Identifier`. This is useful when creating ids, for example, a `UserId` can extend from `Identifier`. Then we can do `UserId::generate()` and we will have a unique `userId` generated using UUIDs.

### Useful objects

[](#useful-objects)

`Internet\Email`: Object representing an email address, it throws exceptions when given email is not a valid email.

`Internet\IpAddress`: Object that represents an IP address, it throws exception when is not a valid ip address.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.7% 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 ~2 days

Total

5

Last Release

3414d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4056757?v=4)[Jonathan Gimeno](/maintainers/jgimeno)[@jgimeno](https://github.com/jgimeno)

---

Top Contributors

[![jgimeno](https://avatars.githubusercontent.com/u/4056757?v=4)](https://github.com/jgimeno "jgimeno (46 commits)")[![destebang](https://avatars.githubusercontent.com/u/4357593?v=4)](https://github.com/destebang "destebang (7 commits)")[![nubeiro](https://avatars.githubusercontent.com/u/135856?v=4)](https://github.com/nubeiro "nubeiro (6 commits)")[![santakadev](https://avatars.githubusercontent.com/u/3189335?v=4)](https://github.com/santakadev "santakadev (1 commits)")

---

Tags

domain-driven-designphp7value-objectValue Objectvalue objectsvalueidentifiers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jgimeno-value-objects/health.svg)

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

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k77.4k89](/packages/pocketmine-pocketmine-mp)[ytake/valueobjects

A PHP library/collection of classes aimed to help developers using and undestanding immutable objects.(temporary package)

6086.5k1](/packages/ytake-valueobjects)[space48/auto-value

Generated immutable value classes for PHP7.1+

291.6k](/packages/space48-auto-value)

PHPackages © 2026

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