PHPackages                             kint/vo - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. kint/vo

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

kint/vo
=======

Simple, yet powerful immutable Value Object.

1.1.6(9y ago)49912[1 issues](https://github.com/cn007b/vo/issues)MITPHP

Since Oct 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/cn007b/vo)[ Packagist](https://packagist.org/packages/kint/vo)[ Docs](https://github.com/cn007b/vo)[ RSS](/packages/kint-vo/feed)WikiDiscussions master Synced 2mo ago

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

ValueObject
-----------

[](#valueobject)

[![Build Status](https://camo.githubusercontent.com/b8921ee9c2eeaf18979c5be0bbad681d31cc3d1298469680bd1cd3a7e93e5196/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636e303037622f766f2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cn007b/vo/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d91e2c0f2bf49dedce1d9526e51e934fff170d29a80e71220f3f7d76bd334848/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636e303037622f766f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cn007b/vo/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/7b33a971b6f004588ef9a82110f29944305a588a1b9a9a85ef3df1bf79687cf9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636e303037622f766f2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cn007b/vo/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/b36945776f669436dabcd9877f47c149abf5226923051a4842a43fa84a5d0473/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3038356533666532343730633432393638663437386438303431663363313736)](https://www.codacy.com/app/cn007b/vo?utm_source=github.com&utm_medium=referral&utm_content=cn007b/vo&utm_campaign=Badge_Grade)[![Maintainability](https://camo.githubusercontent.com/0258552a6317afab6aebc0e0ff957e53cad1127c516481274df32c185640b9a1/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35346637303239343564346361623638636361302f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/cn007b/vo/maintainability)[![SensioLabsInsight](https://camo.githubusercontent.com/d4e038e01dc371bbcb4106b24d0e432abff4bd706efd7af1bb7e890ea9ae445a/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66396165373561352d663136612d346365392d613139342d3864663134363065643466372f6d696e692e706e67)](https://insight.sensiolabs.com/projects/f9ae75a5-f16a-4ce9-a194-8df1460ed4f7)[![Packagist](https://camo.githubusercontent.com/387eb2990b7067b40a5dfd8f435c3341faef3dc3d2c12a19a3da6977b8820f0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b696e742f766f2e737667)](https://packagist.org/packages/kint/vo)[![PRs Welcome](https://camo.githubusercontent.com/25b3e6d0d42c98de74a98cbb4d149a1c09020cf6d1361993b72d7d5b8ffed363/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://makeapullrequest.com)

Value Object (VO) - it's immutable container for your parameters, which knows only about your *parameters* (how to set/get them) and about *validation rules* (what type of data allowed for certain parameter). You are not allowed to create VO with invalid parameters (exception will be thrown) - it provides you opportunity to be sure that your VO is **always valid**. Also, VO is **immutable** - hence you're on safe side and no one will modify your VO since it created!

Main benefits: now you can use this VO everywhere and you don't have to worry about validation, you don't have to mix your business logic with validation code on every application layer (controller, service, model, etc), also you can use it as `type-hint` hence your code will be more clear, interface oriented and more precise.

#### Install

[](#install)

Via composer: `composer require kint/vo`.

#### Usage

[](#usage)

Value object class:

```
