Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-detassigny committed Oct 8, 2020
1 parent aecb0eb commit b5b6b0c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It also supports manually defining dependencies in a YAML file, or even adding s

### Basic usage

This package comes with a Container Provider class which should be your container for you very simply:
Setting up a basic container is quite simple:

```php
use GabrielDeTassigny\SimpleContainer\ContainerProvider;
Expand Down Expand Up @@ -74,12 +74,21 @@ $container = $containerProvider->getContainer();
$container->get(Foo::class); // returns the instance of Foo defined in FooServiceProvider
```

## Why should I use this instead of another container package?
### Ordering

To be honest? Maybe you shouldn't.
When called, the container will look for your service using all 3 above options in that order:
- service provider
- YAML config
- autowiring

## Why use this instead of another container package?

To be honest? Maybe you shouldn't.
I built this mostly out of interest to understand how containers work under the hood.
There are a lot of more evolved PHP containers out there.
However, I tried to make mine straightforward to use.

Furthermore, because it respects PSR-11's container interface,
you can always give it a go and later switch to another container package fairly easily if this one doesn't meet all your needs.
However, I tried to make this package as straightforward to use as possible.
If having a container up and running very quickly appeals to you then feel free to give this a go!

Furthermore, as it respects the standard container interface,
you can always try it for a bit and later switch to another container package without too much hassle.

0 comments on commit b5b6b0c

Please sign in to comment.