PHPackages                             sonofwinter/binding-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. sonofwinter/binding-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

sonofwinter/binding-bundle
==========================

This Bundle provides a binding from array to Entity with Symfony

v1.0.1(10mo ago)33.4kMITPHPPHP &gt;=8.2

Since Feb 1Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/SonOfWinter/BindingBundle)[ Packagist](https://packagist.org/packages/sonofwinter/binding-bundle)[ RSS](/packages/sonofwinter-binding-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (30)Used By (0)

BindingBundle
=============

[](#bindingbundle)

This bundle provides a binding mechanism from array to Entity with Symfony.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 7.0 or higher

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

[](#installation)

Open a command console, enter your project directory and execute:

```
$ composer require sonofwinter/binding-bundle
```

Register the bundle in your `config/bundles.php` file:

```
return [
    // ...
    SOW\BindingBundle\SOWBindingBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

Configure the bundle in your `config/packages/sow_binding.yaml` file:

```
# Default configuration
sow_binding:
    # Use attribute binding method (required for PHP 8+)
    binding_method: attribute

    # Optional: Override the default attribute class
    # attribute_class_name: 'SOW\BindingBundle\Attribute\Binding'
```

Usage
-----

[](#usage)

### Define binding properties in your entity

[](#define-binding-properties-in-your-entity)

```
#[Binding(key: "lastname", setter: "setLastname", type: "string", min: 2, max: 255)]
private string $lastname = '';

#[Binding(key: "firstname")]
private string $firstname = '';

#[Binding(key: "age", type: "integer", min: 0, max: 120)]
private int $age = 0;

#[Binding(key: "user_email", )]
private string $userEmail = '';

#[Binding(key: "test", type: "App\Entity\Test", nullable: true)]
private ?Test $test = null;
```

### Binding options

[](#binding-options)

- `key`: The array value's key (required)
- `setter`: Used if you want to use another setter method name
- `type`: Used for type checking. A BinderTypeException is thrown if the type doesn't match
- `min`/`max`: Check if the value is in the defined range (works with numbers, string length, and array count)
- `nullable`: Defines if a null value can be set to the entity's property (default: false)

### Use Binder service to bind an array to an entity

[](#use-binder-service-to-bind-an-array-to-an-entity)

```
public function __construct(BinderInterface $binder)
{
    $this->binder = $binder;
}

function bind(BindableEntity $be, array $data): BindableEntity
{
    // Example data
    // $data = [
    //     'lastname' => 'Doe',
    //     'firstname' => 'John',
    //     'age' => 20,
    //     'userEmail' => 'some.email@mail.com',
    //     'test' => [
    //         'testProps1' => 'value',
    //         'testProps2' => 'value'
    //     ]
    // ];

    $this->binder->bind($be, $data);
    // Or with include/exclude options:
    // $this->binder->bind($be, $data, ['firstname', 'lastname'], ['age']);

    return $be;
}
```

### Advanced binding options

[](#advanced-binding-options)

You can use include/exclude arrays to control which properties are bound:

```
public function bind(&$object, array $params = [], array $include = [], array $exclude = [])
```

- `$include`: A key array required in `$params`. If one or more keys are missing, an exception is thrown
- `$exclude`: A key array ignored in `$params`. No exception is thrown if a key is present

Changelog
---------

[](#changelog)

For version history and detailed changes, see the [changelog](./changelog) directory.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance54

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 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 ~100 days

Recently: every ~162 days

Total

28

Last Release

321d ago

Major Versions

v0.11.1 → v1.0.02025-07-01

PHP version history (4 changes)v0.1.0PHP &gt;=7.1

v0.9.0PHP &gt;=8.0

v0.11.0PHP &gt;=8.1

v1.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f1e4a07705883a7c4150960abc5b005bfc54d36ac2b88642972b3e7d8a470c4?d=identicon)[SonOfWinter](/maintainers/SonOfWinter)

---

Top Contributors

[![SonOfWinter](https://avatars.githubusercontent.com/u/16906627?v=4)](https://github.com/SonOfWinter "SonOfWinter (55 commits)")

---

Tags

bindingphp8symfony-bundlesymfony7phpsymfonybundlebinding

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sonofwinter-binding-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1714.8k8](/packages/2lenet-crudit-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)
