PHPackages                             lbacik/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lbacik/value-object

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

lbacik/value-object
===================

Simple Value Object implementation

v1.0(4y ago)13.4k[1 issues](https://github.com/lbacik/value-object/issues)2LGPL-2.0-or-laterPHPPHP &gt;=8.0CI failing

Since Sep 26Pushed 3y agoCompare

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

READMEChangelogDependencies (2)Versions (13)Used By (2)

Value Object implementation
===========================

[](#value-object-implementation)

[![PHP Composer](https://github.com/lbacik/value-object/actions/workflows/php.yml/badge.svg)](https://github.com/lbacik/value-object/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/67c22ac9630cd49d7154c7477a647ad13281b4978e464ff057cd4779eabfe257/68747470733a2f2f636f6465636f762e696f2f67682f6c626163696b2f76616c75652d6f626a6563742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4231374451464e4b524d)](https://codecov.io/gh/lbacik/value-object)

Instalation
-----------

[](#instalation)

Value Object on packagist: . To install it you can use [composer](https://getcomposer.org):

```
composer require lbacik/value-object

```

Example
-------

[](#example)

The below example uses assertion, but it is not mandatory of course :)

```
declare(strict_types=1);

use Sushi\ValueObject\Invariant;
use Sushi\ValueObject;

use function PHPUnit\Framework\assertGreaterThanOrEqual;
use function PHPUnit\Framework\assertIsInt;
use function PHPUnit\Framework\assertIsString;

class ExampleValueObject extends ValueObject
{
    private const NAME_MIN_LENGTH = 4;

    public function __construct(
        public readonly string $name,
        public readonly int $age
    ) {
        parent::__construct();
    }

    #[Invariant]
    protected function validateName(): void
    {
        assertGreaterThanOrEqual(self::NAME_MIN_LENGTH, mb_strlen($this->name));
    }

    #[Invariant]
    protected function validateAge(): void
    {
        assertIsInt($this->age);
        assertGreaterThanOrEqual(0, $this->age);
    }
}

$valueObjectOne = new ExampleValueObject(name: "FooBar", age: 30);
```

For **more information** please visit:  (should be updated soon!)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity74

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~128 days

Recently: every ~232 days

Total

11

Last Release

1507d ago

Major Versions

v0.4.1 → v1.02022-04-03

PHP version history (2 changes)v0.0.1PHP &gt;=7.1

v0.4PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/95a0d1fe8d35f2fd34fed52a5bfed0701f2ab04a3073b3bcfcd18c57c845bbfb?d=identicon)[lbacik](/maintainers/lbacik)

---

Top Contributors

[![lbacik](https://avatars.githubusercontent.com/u/7950189?v=4)](https://github.com/lbacik "lbacik (42 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[judev/php-htmltruncator

HTML Truncation library, ported from the html\_truncator rubygem

26286.5k6](/packages/judev-php-htmltruncator)[flarum/pusher

See new discussions and posts in real-time using Pusher.

22367.3k4](/packages/flarum-pusher)[causal/extractor

This extension detects and extracts metadata (EXIF / IPTC / XMP / ...) from potentially thousand different file types (such as MS Word/Powerpoint/Excel documents, PDF and images) and bring them automatically and natively to TYPO3 when uploading assets. Works with built-in PHP functions but takes advantage of Apache Tika and other external tools for enhanced metadata extraction.

16244.5k](/packages/causal-extractor)[awcodes/palette

A color picker field for Filament Forms that uses preset color palettes.

2552.6k5](/packages/awcodes-palette)

PHPackages © 2026

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