PHPackages                             tiny-blocks/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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. tiny-blocks/value-object

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

tiny-blocks/value-object
========================

Delimits default behaviors for Value Objects.

3.2.0(4mo ago)323.2k↓14.3%2MITPHPPHP ^8.5CI passing

Since Jul 26Pushed 2mo agoCompare

[ Source](https://github.com/tiny-blocks/value-object)[ Packagist](https://packagist.org/packages/tiny-blocks/value-object)[ Docs](https://github.com/tiny-blocks/value-object)[ RSS](/packages/tiny-blocks-value-object/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (2)

Value Object
============

[](#value-object)

[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

- [Overview](#overview)
- [Installation](#installation)
- [How to use](#how-to-use)
- [License](#license)
- [Contributing](#contributing)

Overview
--------

[](#overview)

A **V**alue **O**bject (**VO**) is an immutable type that is only distinguishable by the state of its properties, that is, unlike an entity, which has a unique identifier and remains distinct even if its properties are identical, VOs with the same properties can be considered the same.

Because they are immutable, VOs cannot be changed once created. Modifying one is conceptually the same as discard the old one and create a new one.

More details about [VOs](https://martinfowler.com/bliki/ValueObject.html).

Installation
------------

[](#installation)

```
composer require tiny-blocks/value-object
```

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

[](#how-to-use)

The library exposes available behaviors through the `ValueObject` interface, and the implementation of these behaviors through the `ValueObjectAdapter` trait.

### Concrete implementation

[](#concrete-implementation)

With the implementation of the `ValueObject` interface, and the `ValueObjectAdapter` trait, the use of `__get`, `__set` and `__unset` methods is suppressed, making the object immutable.

```
