PHPackages                             noahlvb/valueobject-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. noahlvb/valueobject-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

noahlvb/valueobject-bundle
==========================

Symfony integration for my value object package

v2.0.0(4y ago)12.0k1[1 PRs](https://github.com/noahlvb/php-valueobject-bundle/pulls)MITPHPPHP ^8.0CI failing

Since Mar 23Pushed 1y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (7)Versions (7)Used By (0)

php-valueobject-bundle
======================

[](#php-valueobject-bundle)

Symfony intergation for my value object package

[![CI](https://github.com/noahlvb/php-valueobject-bundle/workflows/CI/badge.svg?branch=master)](https://github.com/noahlvb/php-valueobject-bundle/workflows/CI/badge.svg?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/72f038913af4b865dafaeb65af4bb941bf5f3a00643233f56f0e0dea8e6a7e34/68747470733a2f2f706f7365722e707567782e6f72672f6e6f61686c76622f76616c75656f626a6563742d62756e646c652f762f737461626c65)](https://packagist.org/packages/noahlvb/valueobject-bundle)[![License](https://camo.githubusercontent.com/a410988ff463ed31e0638e70d94c8eb7ffbcf91f18c8f3a438cfd5ddba43bdb1/68747470733a2f2f706f7365722e707567782e6f72672f6e6f61686c76622f76616c75656f626a6563742d62756e646c652f6c6963656e7365)](https://packagist.org/packages/noahlvb/valueobject-bundle)

Installation
------------

[](#installation)

With [composer](http://packagist.org), add:

```
$ composer require noahlvb/valueobject-bundle
```

Run Tests
---------

[](#run-tests)

To make sure everything works you can run tests:

```
$ make test
```

Doctrine DBAL
-------------

[](#doctrine-dbal)

In order to store you own value object just make a new doctrine type extended by `ValueObjectType`. Also add this newly created type to your doctrine config.

```
class EmailAddressType extends ValueObjectType
{
    public function getClassName(): string
    {
        return EmailAddress::class;
    }

    public function getName(): string
    {
        return 'email_address';
    }
}
```

```
doctrine:
    dbal:
        types:
          email_address: SoulSurvivor\Integration\Doctrine\Persistence\Type\ValueEmailAddressType
```

Symfony Forms
-------------

[](#symfony-forms)

If you want to use your value object in a Symfony Form you should make a new form type extending `ValueObjectForm`. And then use that formType in your own form.

```
class EmailAddressForm extends ValueObjectForm
{
    protected function getClassName(): string
    {
        return EmailAddress::class;
    }
}
```

By default `ValueObjectForm` will be a `TextType`. If you wish to override this and make it a `EmailType` for example, override the `getParent()` method with your choose.

```
class EmailAddressForm extends ValueObjectForm
{
    protected function getClassName(): string
    {
        return EmailAddress::class;
    }

    public function getParent()
    {
        return EmailType::class;
    }
}
```

Symfony Validator
-----------------

[](#symfony-validator)

By default the `ValeuObjectForm` will use the `ValueObjectConstraint(Validator)` when validating the form. This will use the build in `isValid()` method of the value objects. If you wish to write your own validation message or extend the validator you can do so in like this.

```
class EmailAddressConstraint extends ValueObjectConstraint
{
    public $message = 'This email address is not valid.';
}
```

```
class EmailAddressConstraintValidator extends ValueObjectConstraintValidator
{
}
```

You have the create a empty class and extend the `ValueObjectConstraintValidator`. This is because Symfony Validator matches the constraint and its validator based on the class names.

Lastly in your form type override the `getConstraintClassName()` with the class name of your newly created constraint. Like this:

```
class EmailAddressForm extends ValueObjectForm
{
    protected function getConstraintClassName(): string
    {
        return EmailAddressConstraint::class;
    }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~153 days

Recently: every ~191 days

Total

6

Last Release

1479d ago

Major Versions

1.0.4 → v2.0.02022-04-30

PHP version history (3 changes)v1.0.0PHP ^7.1

1.0.4PHP &gt;=7.1

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6873972?v=4)[Noah van Bochove](/maintainers/noahlvb)[@noahlvb](https://github.com/noahlvb)

---

Top Contributors

[![noahlvb](https://avatars.githubusercontent.com/u/6873972?v=4)](https://github.com/noahlvb "noahlvb (15 commits)")[![LauLaman](https://avatars.githubusercontent.com/u/8283992?v=4)](https://github.com/LauLaman "LauLaman (1 commits)")

---

Tags

symfonydoctrinedddvaluesFormsOOPvalueobjectsscalar type

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/noahlvb-valueobject-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/noahlvb-valueobject-bundle/health.svg)](https://phpackages.com/packages/noahlvb-valueobject-bundle)
```

###  Alternatives

[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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