PHPackages                             noxkiwi/value - 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. noxkiwi/value

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

noxkiwi/value
=============

I am the value object library. Just a collection of value objects that interact with validators.

21PHP

Since Jul 9Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Value - Ensuring Valid Data Across Your Project
===============================================

[](#value---ensuring-valid-data-across-your-project)

[![Security Rating](https://camo.githubusercontent.com/f615fe77ae4013e9a6684730ef1d3ea1d1e93c5fc3413952fa006af2820d27d3/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e6f786b6977695f76616c7565266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=noxkiwi_value)[![Code Smells](https://camo.githubusercontent.com/f7393c8e519d79225c5e0bf6fb9c1b1156200bfb95cc460b6db78637efb11292/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e6f786b6977695f76616c7565266d65747269633d636f64655f736d656c6c73)](https://sonarcloud.io/summary/new_code?id=noxkiwi_value)[![Lines of Code](https://camo.githubusercontent.com/ff8b3932a021ce2654df1f121099aa2677a5931e322bb133ea1b0176dff52195/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e6f786b6977695f76616c7565266d65747269633d6e636c6f63)](https://sonarcloud.io/summary/new_code?id=noxkiwi_value)[![Quality Gate Status](https://camo.githubusercontent.com/0d940b43e25b4f23ee2f9bab2bf1f6eb615827acb83e615b28455797eb441dc3/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e6f786b6977695f76616c7565266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=noxkiwi_value)

It Began With a Mistake
-----------------------

[](#it-began-with-a-mistake)

In 2016, during the hectic initial phase of our startup, we made a critical mistake that impacted several months of invoice provisions for our sales managers. We mistakenly applied the netToGross tax calculation for sales tax multiple times, even on already gross values, leading to significant errors. This issue went unnoticed for several months, causing considerable trouble. As a result, we developed two separate libraries to ensure valid values across all our platforms.

The first commitment was to ensure valid parameters across the entire projects by creating the Value library. Then, as a logical conclusion, the next step was to implement a standard on how data has to be validated.

```
// The scenario is real, but this example is much simplified, of course.
function netToGross(float $net): float {
    return $net * 1.15;
}
```

[Validator](https://validator.nox.kiwi) 💘 [Value](https://value.nox.kiwi)
=========================================================================

[](#validator--value)

### Validator

[](#validator)

- Checks input for integrity.
- Returns one or more detailed pieces of information on why an input is problematic.

### Value

[](#value)

- Can only be constructed with valid input.
- Once constructed, the input is immutable, ensuring integrity during runtime.

Just an Example
---------------

[](#just-an-example)

Once constructed, our Value objects are immutable. This immutability allows us to use them confidently as parameters and return types, relying on their integrity throughout our application. We replaced standard types like int, float, and string with our Value objects to enhance data integrity and validation. Example Value Objects:

```
NetValue
GrossValue
EmailValue
IbanValue
And many more...

```

Here’s how you can use these Value objects:

```
class Taxes {
    private const SALES_TAX = 0.15; // Correcting to decimal representation for percentage

    /**
     * Converts a NetValue to a GrossValue by applying the sales tax.
     *
     * @param NetValue $netValue The net value object.
     * @return GrossValue The gross value object.
     */
    public static function getGrossFromNet(NetValue $netValue): GrossValue {
        return new GrossValue($netValue->get() * (1 + self::SALES_TAX));
    }
}
```

In this example: `NetValue` and `GrossValue` both are immutable objects representing net and gross monetary values, respectively. The `getGrossFromNet` method converts a net value to a gross value by applying the sales tax, ensuring that the calculation is accurate and reliable.

By using these Value objects, we ensure that our data is validated and consistent across our application, preventing errors like the ones we experienced in the past.

Let's Connect!
--------------

[](#lets-connect)

If you're excited about the possibility of working together or simply want to discuss innovative ideas, I'd love to hear from you. Don't hesitate to reach out via [email](mailto:jan.nox@pm.me).

Let's create something ***amazing*** together!

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c0d9bb9340debe0b8bb79ab33b0b07692904a711f5affaf75df8aa18842dcdb?d=identicon)[noxkiwi](/maintainers/noxkiwi)

![](https://avatars.githubusercontent.com/u/17344619?v=4)[JanNox](/maintainers/JanNox)[@jannox](https://github.com/jannox)

---

Top Contributors

[![Jan-Nox](https://avatars.githubusercontent.com/u/49352527?v=4)](https://github.com/Jan-Nox "Jan-Nox (1 commits)")

### Embed Badge

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

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

###  Alternatives

[fabiopaiva/zf2-doctrine-autocomplete

Provides a autocomplete form for ZF2 and Doctrine2.

104.9k](/packages/fabiopaiva-zf2-doctrine-autocomplete)

PHPackages © 2026

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