PHPackages                             voku/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. voku/value\_objects

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

voku/value\_objects
===================

Value Objects

0.2.0(2mo ago)83[1 issues](https://github.com/voku/value_objects/issues)[6 PRs](https://github.com/voku/value_objects/pulls)MITPHPPHP 7.4.\* || 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\* || 8.4.\* || 8.5.\*CI passing

Since Aug 9Pushed 2w ago2 watchersCompare

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

READMEChangelogDependencies (15)Versions (20)Used By (0)

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

[![Build Status](https://github.com/voku/value_objects/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/voku/value_objects/actions)[![codecov.io](https://camo.githubusercontent.com/fe70c3d1d33b536852160fb9ee5c8cde1ce013276429cba1822befb7f16fdfea/687474703a2f2f636f6465636f762e696f2f6769746875622f766f6b752f76616c75655f6f626a656374732f636f7665726167652e7376673f6272616e63683d6d61696e)](http://codecov.io/github/voku/value_objects?branch=main)

Value Objects
=============

[](#value-objects)

A collection of value objects that can help you to write more readable, self-validated and immutable code.

### Install with Composer

[](#install-with-composer)

```
composer require voku/value_objects
```

### Usage

[](#usage)

```
use voku\ValueObjects\ValueObjectVatPercentage;

require_once __DIR__ . '/vendor/autoload.php'; // example path

$vat = ValueObjectVatPercentage::create('16.0');

$vat->getGross(10.0)); // '11.6'
```

### Unit Tests

[](#unit-tests)

1. [Composer](https://getcomposer.org) is a prerequisite for running the tests.

```
composer install
```

2. The tests can be executed by running this command from the root directory.

```
./vendor/bin/phpunit
```

AbstractHttpProvider methods
----------------------------

[](#abstracthttpprovider-methods)

[create](#createtcreatevaluenull-value-static)[createEmpty](#createempty-static)[decryptFromString](#decryptfromstringstring-password-string-data-static)[encrypt](#encryptstring-password)[jsonSerialize](#jsonserialize-string)[value](#value-tvaluenull)[valueOrFallback](#valueorfallbacktvaluefallback-fallback-tvaluetvaluefallback)[valueOrThrowException](#valueorthrowexception-tvalue)create(\\TCreateValue|null $value): static
------------------------------------------

[](#createtcreatevaluenull-value-static)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `\TCreateValue|null $value`

**Return:**

- `static`

---

createEmpty(): static
---------------------

[](#createempty-static)

[↑](#voku-php-readme-class-methods)

**Parameters:****nothing**

**Return:**

- `static`

---

decryptFromString(string $password, string $data): static
---------------------------------------------------------

[](#decryptfromstringstring-password-string-data-static)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `string $password`
- `string $data`

**Return:**

- `static`

---

encrypt(string $password):
--------------------------

[](#encryptstring-password)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `string $password`

**Return:**

- `string`

---

jsonSerialize(): string
-----------------------

[](#jsonserialize-string)

[↑](#voku-php-readme-class-methods)

**Parameters:****nothing**

**Return:**

- `string`

---

value(): TValue|null
--------------------

[](#value-tvaluenull)

[↑](#voku-php-readme-class-methods)Get the value that are used for the database.

**Parameters:****nothing**

**Return:**

- `\TValue|null`

---

valueOrFallback(\\TValueFallback $fallback): TValue|\\TValueFallback
--------------------------------------------------------------------

[](#valueorfallbacktvaluefallback-fallback-tvaluetvaluefallback)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `\TValueFallback $fallback`

**Return:**

- `\TValue|\TValueFallback`

---

valueOrThrowException(): TValue
-------------------------------

[](#valueorthrowexception-tvalue)

[↑](#voku-php-readme-class-methods)

**Parameters:****nothing**

**Return:**

- `\TValue`

---

### Thanks

[](#thanks)

- Thanks to [GitHub](https://github.com) (Microsoft) for hosting the code and a good infrastructure including Issues-Management, etc.
- Thanks to [IntelliJ](https://www.jetbrains.com) as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
- Thanks to [StyleCI](https://styleci.io/) for the simple but powerful code style check.
- Thanks to [PHPStan](https://github.com/phpstan/phpstan) &amp;&amp; [Psalm](https://github.com/vimeo/psalm) for really great Static analysis tools and for discover bugs in the code!

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 59.6% 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 ~987 days

Total

2

Last Release

70d ago

PHP version history (2 changes)0.1.0PHP 7.4.\* || 8.0.\* || 8.1.\* || 8.2.\*

0.2.0PHP 7.4.\* || 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\* || 8.4.\* || 8.5.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/6456fe693db197c458272cb758bf78958bc7d3e787ccd59db4bf3cf41654316a?d=identicon)[voku](/maintainers/voku)

---

Top Contributors

[![voku](https://avatars.githubusercontent.com/u/264695?v=4)](https://github.com/voku "voku (31 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (12 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (8 commits)")[![deepsource-io[bot]](https://avatars.githubusercontent.com/in/16372?v=4)](https://github.com/deepsource-io[bot] "deepsource-io[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[voku/stringy

A string manipulation library with multibyte support

1863.9M26](/packages/voku-stringy)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

274.2M8](/packages/voku-urlify)[nystudio107/craft-typogrify

Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more

70386.2k18](/packages/nystudio107-craft-typogrify)[topshelfcraft/wordsmith

...because you have the best words.

30349.8k7](/packages/topshelfcraft-wordsmith)[voku/phonetic-algorithms

Phonetic-Algorithms for fuzzy searching | PHP

1842.1k1](/packages/voku-phonetic-algorithms)[ttree/linkeddata

Neos CMS helpers to generate JSON-LD (LinkedData)

1112.0k2](/packages/ttree-linkeddata)

PHPackages © 2026

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