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

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

bhittani/container
==================

PSR-11 dependency injection container implementation with automatic resolution, service providers, facades and macros.

0.6.0(5y ago)0346[2 PRs](https://github.com/kamalkhan/container/pulls)MITPHPPHP ^7.2CI failing

Since Aug 18Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/kamalkhan/container)[ Packagist](https://packagist.org/packages/bhittani/container)[ Docs](https://github.com/kamalkhan/container)[ RSS](/packages/bhittani-container/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (9)Used By (0)

PSR-11 Container
================

[](#psr-11-container)

[![Build Status](https://github.com/kamalkhan/container/workflows/Test/badge.svg)](https://github.com/kamalkhan/container/actions)[![Packagist Downloads](https://camo.githubusercontent.com/2a7a8e9818e4a5a26e56f8953a28135adee2e7d1bd85b2bd585637ec54ae0445/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6268697474616e692f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bhittani/container)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

PSR-11 dependency injection container implementation with automatic resolution, service providers, facades and macros. This package does not require any external dependencies.

- [Install](#install)
- [Usage](#usage)
    - [PSR-11 Implementation](#psr-11-implementation)
    - [Container](#container)
    - [Binding resolution](#binding-resolution)
    - [Automatic dependency resolution](#automatic-dependency-resolution)
    - [Interface resolution](#interface-resolution)
    - [Callable resolution](#callable-resolution)
    - [Custom parameter resolution](#custom-parameter-resolution)
    - [Factory bindings](#factory-bindings)
    - [Shared bindings](#shared-bindings)
    - [Delegates](#delegates)
    - [Service providers](#service-providers)
    - [Facades](#facades)
    - [Macros](#macros)
    - [Deferred Service Providers](#deferred-service-providers)
- [Changelog](#changelog)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [Inspiration](#inspiration)
- [Credits](#credits)
- [License](#license)

Install
-------

[](#install)

You may install this package using [composer](https://getcomposer.org).

```
$ composer require bhittani/container --prefer-dist
```

Usage
-----

[](#usage)

### PSR-11 Implementation

[](#psr-11-implementation)

This package implements the [PSR-11](https://github.com/php-fig/container) container interface, hence, you can easily swap any existing implementation with the container provided in this package.

### Container

[](#container)

In its simplest form, the container stores key value pairs so that it can be accessed later during your application life cycle.

```
