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

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

nih/container
=============

NIH container

0.1.3(2mo ago)071MITPHPPHP 8.4 - 8.5

Since Mar 3Pushed 2mo agoCompare

[ Source](https://github.com/nih-soft/container)[ Packagist](https://packagist.org/packages/nih/container)[ RSS](/packages/nih-container/feed)WikiDiscussions master Synced 1mo ago

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

NIH Container
=============

[](#nih-container)

A lightweight PSR-11 dependency injection container for PHP `8.4+` with autowiring, lazy objects, and circular-reference support.

Contents
--------

[](#contents)

- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
    - [Single Service Definitions: `auto()` and `manual()`](#single-service-definitions-auto-and-manual)
    - [Argument Configuration: `argument()` and `args()`](#argument-configuration-argument-and-args)
    - [Batch Definitions via `add()` and `replace()`](#batch-definitions-via-add-and-replace)
    - [Group Definitions: `inherit()`, `namespace()`, `regex()`](#group-definitions-inherit-namespace-regex)
- [Modes](#modes)
- [Argument Helpers](#argument-helpers)
- [Errors and Exceptions](#errors-and-exceptions)
- [Testing](#testing)
- [Acknowledgements](#acknowledgements)
- [License](#license)

Features
--------

[](#features)

- PSR-11 compatible container (`Psr\Container\ContainerInterface`).
- Autowiring via constructor type hints.
- Configurable object lifecycle:
    - non-shared (default): new instance on each `get()`;
    - shared: singleton-like instances.
- Lazy initialization modes (`Ghost`, `Proxy`, nested modes).
- Circular reference resolution.
- Argument helpers for dynamic wiring (`Arg::get()`, `Arg::new()`, `Arg::id()`).

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

[](#installation)

```
composer require nih/container
```

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

[](#quick-start)

```
