PHPackages                             thiagocordeiro/tiny-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. thiagocordeiro/tiny-container

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

thiagocordeiro/tiny-container
=============================

PHP tiny container for serverless like projects

v0.3.2(3y ago)11201[1 PRs](https://github.com/thiagocordeiro/tiny-container/pulls)MITPHPPHP ^8.1

Since Jun 27Pushed 1y ago2 watchersCompare

[ Source](https://github.com/thiagocordeiro/tiny-container)[ Packagist](https://packagist.org/packages/thiagocordeiro/tiny-container)[ RSS](/packages/thiagocordeiro-tiny-container/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (6)Versions (8)Used By (0)

Tiny Container
==============

[](#tiny-container)

Tiny container is a `psr/container` implementation which allows registering services to be instantiated only when needed, there is no fancy or complex features, for this I would recommend using . The goal is to have container capabilities under psr interface for very tiny projects, when we don't even need a framework.

Installing
----------

[](#installing)

```
composer require thiagocordeiro/tiny-container
```

How to use
----------

[](#how-to-use)

There is not much secret in using this tool.

```
$config = [
    UserRepositoryInterface::class => fn(ContainerInterface $container) => new DoctrineUserRepository(),
    CacheInterface::class => fn(ContainerInterface $container) => new RedisCache(),
    'http.api-client' => fn(ContainerInterface $container) => new GuzzleClient([]),
    MyService::class => fn(ContainerInterface $container) => new MyService(
        $container->get(UserRepositoryInterface::class),
        $container->get(CacheInterface::class),
        $container->get('http.api-client'),
    ),
];

$container = \TinyContainer\TinyContainer($config);

$service = $container->get(MyService::class);
$service->doTheThing();
```

Testing
-------

[](#testing)

```
composer run tests
```

Contributing
------------

[](#contributing)

Feel free to open issues and submit PRs

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~182 days

Recently: every ~199 days

Total

6

Last Release

1285d ago

PHP version history (2 changes)v0.1PHP ^7.4 || ^8.0

v0.3.1PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![thiagocordeiro](https://avatars.githubusercontent.com/u/1073649?v=4)](https://github.com/thiagocordeiro "thiagocordeiro (8 commits)")[![JulianaSaran](https://avatars.githubusercontent.com/u/118539731?v=4)](https://github.com/JulianaSaran "JulianaSaran (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/thiagocordeiro-tiny-container/health.svg)

```
[![Health](https://phpackages.com/badges/thiagocordeiro-tiny-container/health.svg)](https://phpackages.com/packages/thiagocordeiro-tiny-container)
```

###  Alternatives

[symfony/dependency-injection

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

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

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

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

564576.7k52](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M270](/packages/symfony-type-info)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

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