Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Stratadox/Di
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratadox committed Jul 1, 2017
2 parents 9839cd9 + e3fd914 commit 6ce07b5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Di [![Build Status](https://travis-ci.org/Stratadox/Di.svg?branch=master)](https://travis-ci.org/Stratadox/Di)
A most simplistic Dependency Injection Container
# Di

[![Build Status](https://travis-ci.org/Stratadox/Di.svg?branch=master)](https://travis-ci.org/Stratadox/Di)
[![Coverage Status](https://coveralls.io/repos/github/Stratadox/Di/badge.svg?branch=master)](https://coveralls.io/github/Stratadox/Di?branch=master)

A minimalistic Dependency Injection Container

Services are lazy loaded through the use of anonymous functions.

Expand Down Expand Up @@ -57,7 +61,7 @@ $di->set('collaborator', function () {
});

$di->set('main_service', function () use ($di) {
return new MainService($di->get('collaborator');
return new MainService($di->get('collaborator'));
});

$service = $di->get('main_service');
Expand Down Expand Up @@ -87,6 +91,8 @@ You can assert the service to be of a certain class or implement an interface wh
```php
$foo = $di->get('foo', Foo::class);
```
If the type assertion fails, an InvalidServiceException is thrown.

## Cache

By default, services are cached. You can trigger the factory on each request by setting cache to false.
Expand Down

0 comments on commit 6ce07b5

Please sign in to comment.