PHPackages                             nalgoo/return-type-container - 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. nalgoo/return-type-container

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

nalgoo/return-type-container
============================

PSR-11 Container which gets entries based on return values of its public methods

1.0.0(7y ago)02.5k↓42.9%MITPHP

Since Apr 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/nalgoo/return-type-container)[ Packagist](https://packagist.org/packages/nalgoo/return-type-container)[ RSS](/packages/nalgoo-return-type-container/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Install
=======

[](#install)

```
composer require nalgoo/return-type-container

```

Usage
=====

[](#usage)

Either `use ReturnTypeContainerTrait` in your service class or extend `ReturnTypeContainer`

**Example:**

```

class ServiceContainer
{
	use ReturnTypeContainerTrait;

	public function getDatabaseConnection(): Connection
	{
		$connection = new Connection();

		...

		return $connection;
	}

	public function getLogger(): LoggerInterface
	{
		static $logger;

		return $logger ?: $logger = new Logger();
	}

	// this ReturnType won't be accessible by `get` method
	private function getDependency(): Dependency
	{
		return new Dependency();
	}

}

```

ContainerChain
==============

[](#containerchain)

Helper class to be able to chain multiple PSR-11 containers.

**Example:**

```

$containerChain = new ContainerChain(
	new FirstToSearchContainer(),
	new SecondToSearchContainer()
);

$app = new App($containerChain);

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2639d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45479117045e318b73b42b47cff564fe1c0b16079a1feed4eaeea7c49adf8a4a?d=identicon)[nalgoo](/maintainers/nalgoo)

---

Top Contributors

[![senasi](https://avatars.githubusercontent.com/u/12956618?v=4)](https://github.com/senasi "senasi (8 commits)")

### Embed Badge

![Health badge](/badges/nalgoo-return-type-container/health.svg)

```
[![Health](https://phpackages.com/badges/nalgoo-return-type-container/health.svg)](https://phpackages.com/packages/nalgoo-return-type-container)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k447.1M9.1k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706127.7M12.7k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31180.7M2.3k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

20062.9M227](/packages/symfony-type-info)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)

PHPackages © 2026

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