Skip to content

Commit

Permalink
Documentation improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
doublecompile committed Sep 19, 2016
1 parent 3284457 commit 49fa17a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ Caridea is a miniscule PHP application library. This shrimpy fellow is what you'

![](http://libreworks.com/caridea-100.png)

This is its dependency injection container. We included two containers.

The `Caridea\Container\Properties` class is intended for scalar configuration values that might be used as settings for other components.

The `Caridea\Container\Objects` class allows for eager, lazy, and prototype objects. It also implements `Caridea\Event\Publisher` and will broadcast events to any managed object which implements `Caridea\Event\Listener`.

You can retrieve contained objects both by name and by type!
This is its dependency injection container.

[![Packagist](https://img.shields.io/packagist/v/caridea/container.svg)](https://packagist.org/packages/caridea/container)
[![Build Status](https://travis-ci.org/libreworks/caridea-container.svg)](https://travis-ci.org/libreworks/caridea-container)
Expand All @@ -35,6 +29,15 @@ Releases of this library will conform to [Semantic Versioning](http://semver.org

Our code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!

## Overview

* The `Caridea\Container\Properties` class is intended for scalar configuration values that might be used as settings for other components.
* The `Caridea\Container\Objects` class allows for eager, lazy, and prototype objects.
* It also implements `Caridea\Event\Publisher` and will broadcast events to any managed object which implements `Caridea\Event\Listener`.
* The `Caridea\Container\EmptyContainer` class is an empty, no-op container.

You can retrieve contained objects both by name and by type!

## Examples

Just a few quick examples.
Expand Down Expand Up @@ -64,10 +67,6 @@ $objects = \Caridea\Container\Objects::builder()
$userService = $objects->get('userService');
```

* `\Caridea\Container\Properties` is meant to hold static, scalar properties.
* `\Caridea\Container\Objects` is meant to hold complex objects with dependencies.
* `\Caridea\Container\EmptyContainer` is an empty, no-op container.

### Parent Delegation

You can nest Objects containers. For example, you can have a container with service objects and a child container with web controllers.
Expand Down Expand Up @@ -102,11 +101,11 @@ $objects->publish(new CustomEvent());
// Here, the eventListener object will have its ->notify() method invoked with the CustomEvent
```

Any objects returned from `get()` that implement `\Caridea\Event\PublisherAware` will receive the container via the `setPublisher` method.
Any objects returned from an `Objects` container that implement `\Caridea\Event\PublisherAware` will receive the container via the `setPublisher` method.

### ContainerAware

Any objects returned from `get()` which implement `\Caridea\Container\ContainerAware` will receive the container via the `setContainer` method.
Any objects returned from an `Objects` container that implement `\Caridea\Container\ContainerAware` will receive the container via the `setContainer` method.
We provide a trait to make this easier.

```php
Expand Down

0 comments on commit 49fa17a

Please # to comment.