PHPackages                             resolver-interop/interface - 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. resolver-interop/interface

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

resolver-interop/interface
==========================

Interoperable autowiring resolver interfaces for PHP.

1.x-dev(3mo ago)01MITPHPPHP &gt;=8.4CI passing

Since Feb 6Pushed 3mo agoCompare

[ Source](https://github.com/resolver-interop/interface)[ Packagist](https://packagist.org/packages/resolver-interop/interface)[ Docs](https://github/com/resolver-interop/interface)[ RSS](/packages/resolver-interop-interface/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (5)Versions (1)Used By (0)

Resolver-Interop Standard Interface Package
===========================================

[](#resolver-interop-standard-interface-package)

Resolver-Interop provides an interoperable package of standard interfaces for autowiring resolver functionality. It reflects, refines, and reconciles the common practices identified within [several pre-existing projects](./README-RESEARCH.md).

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://www.rfc-editor.org/info/bcp14) ([RFC 2119](https://datatracker.ietf.org/doc/html/rfc2119), [RFC 8174](https://datatracker.ietf.org/doc/html/rfc8174)).

Interfaces
----------

[](#interfaces)

This package defines the following interfaces:

- [*ResolverService*](#resolverservice) affords resolving classes, calls, parameter arrays, and types.
- [*ReflectionParameterResolver*](#reflectionparameterresolver) affords resolving a [*ReflectionParameter*](https://php.net/ReflectionParameter) to an argument value.
- [*ReflectionMethodResolver*](#reflectionmethodresolver) affords invoking a method on an object.
- [*ReflectionPropertyResolver*](#reflectionpropertyresolver) affords setting a property on an object.
- [*Resolvable*](#Resolvable) affords allowing the implementing object to resolve itself to a value.
- [*ResolverThrowable*](#resolverthrowable) extends [*Throwable*](https://php.net/Throwable) to mark an [*Exception*](https://php.net/Exception) as resolver-related.

### *ResolverService*

[](#resolverservice)

[*ResolverService*](#resolverservice) affords resolving classes, calls, parameter arrays, and types.

#### *ResolverService* Methods

[](#resolverservice-methods)

- ```
    public function resolveClass(
        IocInterop\Interface\IocContainer $ioc,
        class-string $class,
        mixed[] $arguments = [],
    ) : T;
    ```

    - Resolves the `$class` to return a new instance.
    - Directives:

        - Implementations MUST support parameter injection on the `$class`constructor using logic equivalent to that specified by `resolveParameters()`.
        - Implementations MAY support [*ReflectionPropertyResolver*](#reflectionpropertyresolver)attributes on the instantiated `$class` properties.
        - Implementations MAY support [*ReflectionMethodResolver*](#reflectionmethodresolver)attributes on the instantiated `$class` methods.
        - Implementations MAY support other forms of injection not specified herein.
        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the `$class`cannot be resolved.
- ```
    public function isResolvableClass(string $class) : bool;
    ```

    - Does the `$class` exist, and is it instantiable?
- ```
    public function resolveCall(
        IocInterop\Interface\IocContainer $ioc,
        callable $callable,
        mixed[] $arguments = [],
    ) : mixed;
    ```

    - Resolves the `$callable` to return its result.
    - Directives:

        - Implementations MUST support parameter injection on the `$callable`using logic equivalent to that specified by `resolveParameters()`.
        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the `$callable` cannot be resolved.
- ```
    public function resolveParameters(
        IocInterop\Interface\IocContainer $ioc,
        ReflectionParameter[] $parameters,
        mixed[] $arguments = [],
    ) : mixed[];
    ```

    - Resolves the `$parameters` into the `$arguments`.
    - Directives:

        - Implementations MUST NOT attempt to resolve a [*ReflectionParameter*](https://php.net/ReflectionParameter) whose name or position already exists in the `$arguments` keys.
        - When resolving a [*ReflectionParameter*](https://php.net/ReflectionParameter) to an argument, implementations MUST do so using logic equivalent to that specified by [*ReflectionParameterResolver*](#reflectionparameterresolver).
        - Implementations MUST retain each resolved [*ReflectionParameter*](https://php.net/ReflectionParameter)by name in the `$arguments`.
        - Implementations MUST resolve all [*Resolvable*](#Resolvable) objects in the `$arguments`.
- ```
    public function resolveType(
        IocInterop\Interface\IocContainer $ioc,
        ReflectionType $type,
    ) : ?string;
    ```

    - Resolves a [*ReflectionType*](https://php.net/ReflectionType) to a string, or `null` if it cannot be be resolved.
    - Notes:

        - **TBD** Typically only for named types, but may help to convert union and intersection types to a single named type.

### *ReflectionParameterResolver*

[](#reflectionparameterresolver)

[*ReflectionParameterResolver*](#reflectionparameterresolver) affords resolving a [*ReflectionParameter*](https://php.net/ReflectionParameter) to an argument value.

- Notes:

    - **This interface can be implemented as an attribute.** Doing so allows implementors to define custom resolution approaches for consumers to apply to specific [*ReflectionParameter*](https://php.net/ReflectionParameter)s. For example, implementors may declare a `#[GetEnv($name)]` attribute to resolve the [*ReflectionParameter*](https://php.net/ReflectionParameter) to an environment value.

#### *ReflectionParameterResolver* Methods

[](#reflectionparameterresolver-methods)

- ```
    public function resolveParameter(
        IocInterop\Interface\IocContainer $ioc,
        ReflectionParameter $parameter,
    ) : mixed;
    ```

    - Resolves the [*ReflectionParameter*](https://php.net/ReflectionParameter) to an argument value.
    - Directives:

        - Implementations MUST resolve the `$parameter` in this order:

            - If the `$parameter` has an [*Attribute*](https://php.net/Attribute) that implements [*ReflectionParameterResolver*](#reflectionparameterresolver), implementations MUST resolve the `$parameter` using that attribute.
            - Otherwise, if the `$parameter` type is resolvable using logic equivalent to the \[*ReflectionService*\]\[\] method `resolveType()` and the container has a service for that type, implementations MUST resolve the `$parameter` to that service.
            - Otherwise, implementations MAY attempt to resolve the `$parameter` using implementation-specific logic; such logic is not defined herein.
            - Otherwise, if the `$parameter` has a default value, implementations MUST resolve the `$parameter` to that value.
        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the `$parameter` cannot be resolved.

### *ReflectionMethodResolver*

[](#reflectionmethodresolver)

[*ReflectionMethodResolver*](#reflectionmethodresolver) affords invoking a method on an object.

- Notes:

    - **This interface can be implemented as an attribute.** Doing so allows implementors to define custom resolution approaches for consumers to apply to specific [*ReflectionMethod*](https://php.net/ReflectionMethod)s.

#### *ReflectionMethodResolver* Methods

[](#reflectionmethodresolver-methods)

- ```
    public function resolveMethod(
        IocInterop\Interface\IocContainer $ioc,
        ReflectionMethod $method,
        object $object,
    ) : void;
    ```

    - Invokes the [*ReflectionMethod*](https://php.net/ReflectionMethod) on the `$object`.
    - Directives:

        - Implementations MUST support parameter injection using logic equivalent to that specified by [*ReflectionParametersResolver*](#reflectionparametersresolver).
        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the `$method` cannot be resolved.
    - Notes:

        - **TBD** $object is by reference so you can set to a replacement object a la immutability.

### *ReflectionPropertyResolver*

[](#reflectionpropertyresolver)

[*ReflectionPropertyResolver*](#reflectionpropertyresolver) affords setting a property on an object.

- Notes:

    - **This interface can be implemented as an attribute.** Doing so allows implementors to define custom resolution approaches for consumers to apply to specific [*ReflectionProperty*](https://php.net/ReflectionProperty)s.

#### *ReflectionPropertyResolver* Methods

[](#reflectionpropertyresolver-methods)

- ```
    public function resolveProperty(
        IocInterop\Interface\IocContainer $ioc,
        ReflectionProperty $property,
        object $object,
    ) : void;
    ```

    - Sets the [*ReflectionProperty*](https://php.net/ReflectionProperty) on an object.
    - Directives:

        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the `$property` cannot be resolved.

### *Resolvable*

[](#resolvable)

[*Resolvable*](#Resolvable) affords allowing the implementing object to resolve itself to a value.

- Notes:

    - **TBD** Use to defer container calls (i.e. lazy salls), then can use in $arguments without actually creating anything until the moment of resolution.

#### *Resolvable* Methods

[](#resolvable-methods)

- ```
    public function resolve(IocInterop\Interface\IocContainer $ioc) : mixed;
    ```

    - Resolves the implementing object to a value.
    - Directives:

        - Implementations MUST throw [*ResolverThrowable*](#resolverthrowable) if the object cannot be resolved.
        - **TBD** Must recursively resolve all Resolvable in the resolved value.

### *ResolverThrowable*

[](#resolverthrowable)

[*ResolverThrowable*](#resolverthrowable) extends [*Throwable*](https://php.net/Throwable) to mark an [*Exception*](https://php.net/Exception) as resolver-related.

It adds no class members.

Implementations
---------------

[](#implementations)

- Directives:

    - Implementations MAY define additional class members not defined in these interfaces.
- Notes:

    - **Reference implementations** may be found at .

Q &amp; A
---------

[](#q--a)

---

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance81

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

102d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25754?v=4)[Paul M. Jones](/maintainers/pmjones)[@pmjones](https://github.com/pmjones)

---

Top Contributors

[![pmjones](https://avatars.githubusercontent.com/u/25754?v=4)](https://github.com/pmjones "pmjones (2 commits)")

---

Tags

Autowiringresolverautowire

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/resolver-interop-interface/health.svg)

```
[![Health](https://phpackages.com/badges/resolver-interop-interface/health.svg)](https://phpackages.com/packages/resolver-interop-interface)
```

###  Alternatives

[dflydev/placeholder-resolver

Given a data source representing key =&gt; value pairs, resolve placeholders like ${foo.bar} to the value associated with the 'foo.bar' key in the data source.

14414.6M3](/packages/dflydev-placeholder-resolver)[rybakit/arguments-resolver

ArgumentsResolver allows you to determine the arguments to pass to a function or method.

26107.7k7](/packages/rybakit-arguments-resolver)[sroze/argument-resolver

A lightweight utility to resolve method arguments based on types and names

1041.4k1](/packages/sroze-argument-resolver)

PHPackages © 2026

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