PHPackages                             switon/binding - 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. [Framework](/categories/framework)
4. /
5. switon/binding

ActiveLibrary[Framework](/categories/framework)

switon/binding
==============

Argument and input binding primitives for Switon Framework

v1.0.0(1mo ago)0306MITPHPPHP &gt;=8.3CI passing

Since May 10Pushed 3d agoCompare

[ Source](https://github.com/switon-php/binding)[ Packagist](https://packagist.org/packages/switon/binding)[ Docs](https://github.com/switon-php/binding)[ RSS](/packages/switon-binding/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (2)Used By (6)

Switon Binding Package
======================

[](#switon-binding-package)

[![CI](https://camo.githubusercontent.com/65dd891f8787d1324169f212bbc67e604f8092477e7f8f51583bf477bf8e1811/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f62696e64696e672f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/switon-php/binding/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's binding layer for `#[ResolvedBy]` classes, action arguments, and typed input objects.

Highlights
----------

[](#highlights)

- **Declared resolution:** `#[ResolvedBy]` lets a class declare its resolver.
- **Action argument binding:** parameters can come from events, resolvers, the container, or plain input.
- **Typed input binding:** arrays can become typed objects with validation and nested data support.
- **Separate paths:** scalar values and objects use separate binding flows.
- **Resolution events:** argument resolution emits its own lifecycle events.

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

[](#installation)

```
composer require switon/binding
```

Quick Start
-----------

[](#quick-start)

Binding starts with `PageResolver`.

```
use Switon\Binding\Attribute\ResolvedBy;
use Switon\Orm\PageResolver;

#[ResolvedBy(PageResolver::class)]
class Page
{
    protected int $page;
    protected int $limit;

    public static function of(int $page, int $limit = 10): static
    {
        $instance = new static();
        $instance->page = max(1, $page);
        $instance->limit = max(1, $limit);

        return $instance;
    }
}
```

```
use ReflectionParameter;
use Switon\Core\Attribute\Autowired;
use Switon\Binding\ValueResolverInterface;
use Switon\Core\InputInterface;
use Switon\Orm\Page;

final class PageResolver implements ValueResolverInterface
{
    #[Autowired] protected InputInterface $input;

    public function resolve(ReflectionParameter $parameter, string $type): mixed
    {
        return Page::of(
            (int) $this->input->get('page', 1),
            (int) $this->input->get('size', 10)
        );
    }
}
```

```
use Switon\Orm\Page;

final class ArticleController
{
    public function indexAction(Page $page): void
    {
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance97

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc0f20ad15b0ae9fbf9c6e2cd3008692b0c88a877ec8d3e0119211314bf86fc8?d=identicon)[switon](/maintainers/switon)

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (2 commits)")

---

Tags

argumentsbindinghydrationswitonbindingargumentshydrationswiton

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M395](/packages/drupal-core-recommended)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)[typo3/cms-core

TYPO3 CMS Core

3312.9M4.7k](/packages/typo3-cms-core)[windwalker/framework

The next generation PHP framework.

25640.0k1](/packages/windwalker-framework)

PHPackages © 2026

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