PHPackages                             neunerlei/container-autowiring-declaration - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. neunerlei/container-autowiring-declaration

AbandonedArchivedLibrary[PSR &amp; Standards](/categories/psr-standards)

neunerlei/container-autowiring-declaration
==========================================

A declaration library to extend PSR-11 for dynamic auto-wring based on interfaces

1.1.1(3y ago)02.0k2Apache-2.0PHPPHP ^7.3

Since Feb 27Pushed 3y agoCompare

[ Source](https://github.com/Neunerlei/container-autowiring-declaration)[ Packagist](https://packagist.org/packages/neunerlei/container-autowiring-declaration)[ RSS](/packages/neunerlei-container-autowiring-declaration/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (2)

ABANDONED/DEPRECATED
--------------------

[](#abandoneddeprecated)

This package should no longer be used and removed from code sources. It is deprecated without replacement.

PSR-11 Autowiring Declaration
=============================

[](#psr-11-autowiring-declaration)

This package contains some interfaces to extends the [PSR-11 Container definition](https://www.php-fig.org/psr/psr-11/) with auto-wiring hints based on interfaces.

The goal is, to describe classes for a container implementations by interfaces and not via configuration files.

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

[](#installation)

Install this package using composer:

```
composer require labor-digital/container-autowiring-declaration

```

Interfaces
----------

[](#interfaces)

`Namespace: Neunerlei\ContainerAutoWiringDeclaration`

### SingletonInterface

[](#singletoninterface)

Any class that implements this interface MUST be handled as singleton, this means that every time it is requested from the container, the same instance will be returned.

### InjectableInterface

[](#injectableinterface)

Every class that implements this interface MUST be scanned by the auto-wirer.

- All public methods that start with "inject" MUST automatically be wired as setters of additional dependencies.
- An inject method CAN either have a single or multiple properties to be injected.
- If an inject method does not have any properties it MUST be skipped without errors.

### AutoWiringExceptionInterface

[](#autowiringexceptioninterface)

Any auto-wiring related exception MUST implement this interface

Definition Interfaces
---------------------

[](#definition-interfaces)

`Namespace: Neunerlei\ContainerAutoWiringDeclaration\Definition`

This section is a secondary definition which defines an interchange format of auto-wiring configuration definitions. Using these interfaces you are able to create a universal auto-wiring handler.

### AutoWiringDefinitionProviderInterface

[](#autowiringdefinitionproviderinterface)

The main repository that creates and stores auto wiring definitions for the classes of you application. The auto-wirer MUST get it's definitions using the definition provider.

```
namespace Neunerlei\ContainerAutoWiringDeclaration\Definition;
interface AutoWiringDefinitionProviderInterface {

	/**
	 * Adds a new auto wiring definition to the list of registered definitions.
	 *
	 * @param AutoWiringClassInterface $definition
	 *
	 * @return $this
	 */
	public function setAutoWiringDefinition(AutoWiringClassInterface $definition);

	/**
	 * Returns a auto wiring definition object for the given class name.
	 *
	 * @param string $className The name of the class to get the definition object for
	 *
	 * @return AutoWiringClassInterface
	 */
	public function getAutoWiringDefinition(string $className): AutoWiringClassInterface;

}
```

### AutoWiringClassInterface

[](#autowiringclassinterface)

Describes the auto wiring definition of a single class.

```
namespace Neunerlei\ContainerAutoWiringDeclaration\Definition;
interface AutoWiringClassInterface {

	/**
	 * Returns the name of the class described in this definition instance
	 * @return string
	 */
	public function getName(): string;

	/**
	 * Returns true if the class should be handled as singleton. Meaning the container should always
	 * return he same instance after it was created once.
	 * @return bool
	 */
	public function isSingleton(): bool;

	/**
	 * Returns the list of constructor parameters
	 * @return AutoWiringParameterInterface[]
	 */
	public function getConstructorParams(): array;

	/**
	 * Returns the list of inject methods of this class.
	 * This MUST return an empty array if the class does not implement the Injectable interface
	 * @return AutoWiringMethodInterface[]
	 * @see \Neunerlei\ContainerAutoWiringDeclaration\InjectableInterface
	 */
	public function getInjectMethods(): array;

}
```

### AutoWiringMethodInterface

[](#autowiringmethodinterface)

Describes the auto wiring definition of a single method inside a class.

```
namespace Neunerlei\ContainerAutoWiringDeclaration\Definition;
interface AutoWiringMethodInterface {

	/**
	 * Returns the auto-wiring class definition
	 * @return \Neunerlei\ContainerAutoWiringDeclaration\Definition\AutoWiringClassInterface
	 */
	public function getClass(): AutoWiringClassInterface;

	/**
	 * Returns the name of the method
	 *
	 * @return string
	 */
	public function getName(): string;

	/**
	 * Returns the list of parameters that should be set for this method.
	 *
	 * @return AutoWiringParameterInterface[]
	 */
	public function getParameters(): array;
}
```

### AutoWiringParameterInterface

[](#autowiringparameterinterface)

Describes the auto wiring definition of a single parameter of a method inside a class.

```
namespace Neunerlei\ContainerAutoWiringDeclaration\Definition;
interface AutoWiringParameterInterface {

	/**
	 * Returns the auto-wiring method definition
	 * @return \Neunerlei\ContainerAutoWiringDeclaration\Definition\AutoWiringMethodInterface
	 */
	public function getMethod(): AutoWiringMethodInterface;

	/**
	 * Returns the name of the parameter
	 *
	 * @return string
	 */
	public function getName(): string;

	/**
	 * Returns true if the parameter has a defined type class that can be instantiated
	 * @return bool
	 */
	public function hasType(): bool;

	/**
	 * Returns the type of the parameter as a string or null if there is none
	 * @return string|null
	 */
	public function getType(): ?string;

	/**
	 * Returns true if this parameter should have a lazy loading proxy
	 * @return bool
	 */
	public function isLazy(): bool;

	/**
	 * Returns true if a default value exists, false if not
	 * @return bool
	 */
	public function hasDefaultValue(): bool;

	/**
	 * Returns the default value or null if there is none
	 * @return mixed
	 */
	public function getDefaultValue();
}
```

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment I highly appreciate you sending me a postcard from your hometown, mentioning which of our package(s) you are using.

You can find my address [here](https://www.neunerlei.eu/).

Thank you :D

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

2

Last Release

1339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eb1c26fb5a535cd7a656faffbae7929009558b2bfa6156b2be7b636d689e13a?d=identicon)[labor-digital](/maintainers/labor-digital)

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

### Embed Badge

![Health badge](/badges/neunerlei-container-autowiring-declaration/health.svg)

```
[![Health](https://phpackages.com/badges/neunerlei-container-autowiring-declaration/health.svg)](https://phpackages.com/packages/neunerlei-container-autowiring-declaration)
```

###  Alternatives

[phpdocumentor/type-resolver

A PSR-5 based resolver of Class names, Types and Structural Element Names

9.2k719.5M166](/packages/phpdocumentor-type-resolver)[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[league/container

A fast and intuitive dependency injection container.

86387.8M342](/packages/league-container)[stella-maris/clock

A pre-release of the proposed PSR-20 Clock-Interface

7947.5M2](/packages/stella-maris-clock)[wptrt/wpthemereview

PHP\_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org

217736.5k29](/packages/wptrt-wpthemereview)[inpsyde/modularity

Modular PSR-11 implementation for WordPress plugins, themes or libraries.

54383.3k3](/packages/inpsyde-modularity)

PHPackages © 2026

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