Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexzvn/container-di

Simple IoC container with some method: bind, singleton, resolve, make.
https://github.com/alexzvn/container-di

composer ioc-container php-library php7 singleton

Last synced: 13 days ago
JSON representation

Simple IoC container with some method: bind, singleton, resolve, make.

Awesome Lists containing this project

README

        

# ContainerDI

Simple IoC container with some method: bind, singleton, resolve, make.

## Install

### Install Composer
```bash
composer require iquxbyte/container-di
```

### Install Non-Composer
Just download this repo and include `path/to/src/__autoload.php`.

## Use

### Bind

```php
ContainerDI::bind(Foo::class);
```

### Singleton

```php
ContainerDI::singleton(FooBarContract::class, FooBar::class);
```

### Make class

```php
ContainerDI::make(FooBarContract::class, FooBar::class);
```

### Resolve class

```php
ContainerDI::make(Foo::class);
```

## Example

```php