PHPackages                             apie/composite-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. apie/composite-value-objects

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

apie/composite-value-objects
============================

Composer package of the apie library: composite value objects

1.0.0.x-dev(1y ago)01.1kMITPHPPHP &gt;=8.1

Since Sep 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/apie-lib/composite-value-objects)[ Packagist](https://packagist.org/packages/apie/composite-value-objects)[ RSS](/packages/apie-composite-value-objects/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

[![](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)

composite-value-objects
=======================

[](#composite-value-objects)

[![Latest Stable Version](https://camo.githubusercontent.com/8ccff1d373ebf54367ac79b60d2081008487a856f3840fe555f3f846f42f8060/687474703a2f2f706f7365722e707567782e6f72672f617069652f636f6d706f736974652d76616c75652d6f626a656374732f76)](https://packagist.org/packages/apie/composite-value-objects) [![Total Downloads](https://camo.githubusercontent.com/38b60d69b008e49296cf428a74b71118358d975b1f788fd0775cc50f8666f804/687474703a2f2f706f7365722e707567782e6f72672f617069652f636f6d706f736974652d76616c75652d6f626a656374732f646f776e6c6f616473)](https://packagist.org/packages/apie/composite-value-objects) [![Latest Unstable Version](https://camo.githubusercontent.com/1b17f9f24812b7b18d740a1256ad34d564ef446e15fc9a0515c6b2319089715f/687474703a2f2f706f7365722e707567782e6f72672f617069652f636f6d706f736974652d76616c75652d6f626a656374732f762f756e737461626c65)](https://packagist.org/packages/apie/composite-value-objects) [![License](https://camo.githubusercontent.com/0e6cf83244eaff9f9791e5dab2d7b9dde59c92c84a34a1dc1394ce6d91956cd8/687474703a2f2f706f7365722e707567782e6f72672f617069652f636f6d706f736974652d76616c75652d6f626a656374732f6c6963656e7365)](https://packagist.org/packages/apie/composite-value-objects) [![PHP Version Require](https://camo.githubusercontent.com/9a93eb08e9943e16d6365b0972a49d60eebf2a0f03122b0c787e7a1840eb9390/687474703a2f2f706f7365722e707567782e6f72672f617069652f636f6d706f736974652d76616c75652d6f626a656374732f726571756972652f706870)](https://packagist.org/packages/apie/composite-value-objects) [![Code coverage](https://raw.githubusercontent.com/apie-lib/composite-value-objects/main/coverage_badge.svg)](https://apie-lib.github.io/coverage/composite-value-objects/index.html)

[![PHP Composer](https://github.com/apie-lib/composite-value-objects/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/apie-lib/composite-value-objects/actions/workflows/php.yml)

This package is part of the [Apie](https://github.com/apie-lib) library. The code is maintained in a monorepo, so PR's need to be sent to the [monorepo](https://github.com/apie-lib/apie-lib-monorepo/pulls)

Documentation
-------------

[](#documentation)

Composite value objects is mainly a trait that can be used inside value objects for value objects that are a composite of value objects or primitives. For example a range value object is often best used as a value object itself because the start and the end of the range should be in a restricted range..

### Usage

[](#usage)

All you need to do is make an object with the ValueObjectInterface and the CompositeValueObject trait. Then all you need are properties and fromNative and toNative will change accordingly.

For example:

```
