<commit_before># Acclimate - Container Adapters

[![License](https://poser.pugx.org/acclimate/container/license.png)](https://packagist.org/packages/acclimate/container) [![Latest Stable Version](https://poser.pugx.org/acclimate/container/v/stable.png)](https://packagist.org/packages/acclimate/container) [![Build Status](https://travis-ci.org/jeremeamia/acclimate-container.png)](https://travis-ci.org/jeremeamia/acclimate-container) [![Code Coverage](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/badges/coverage.png?s=fe11762e3c76d92ffbd4a7220e6b72c958d62b41)](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/badges/quality-score.png?s=30cc017c8a53f50fec5b5becd7aa648930b9a1c0)](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/)

**Get Acclimated!** Use any third-party dependency injection containers and service locators in your code by adapting
them to a common container interface. Acclimate was created by [<NAME>](https://twitter.com/jeremeamia).

## Introduction

It seems like every framework has its own container object. They come in many shapes and sizes (service locator, service
manager, service container, dependency injection (DI) container, registry, etc.), but are all generally used in a
similar way.

The wide variety of implementations makes it hard for other frameworks, framework-agnostic libraries, or some
applications to get the full benefits of using an inversion of control (IoC) system, because they either need to:

1. Write their own container implementation (NIH Syndrome)
2. Have a long-term dependency on a particular, third-party container implementation (and force that dependency on
   their users, which may already be using a different container implementation)
3. Implement an abstraction layer to support one or more third-party containers

**Acclimate** is a library that does \#3 for you. It provides a set of adapters for the most popular
container implementations. This allows you to adapt, _or "acclimate"_, instances of these containers to a common,
normalized, and **interoperable** interface. Using Acclimate allows your framework, library, or application to retrieve
items from the container objects of third-party libraries. That's interoperability!

## The Container Interface

The `ContainerInterface` used by Acclimate comes from the
[`container-interop/container-interop`](https://github.com/container-interop/container-interop) project. It attempts
to normalize the various implementations of container interfaces (whether they be for service locators, dependency
injection containers, or something else similar) to a simple, readonly interface, that allows users to retrieve
entries from from any third-party container in a consistent way.

The `ContainerInterface` looks like this:

```php
namespace Interop\Container;

interface ContainerInterface
{
    /**
     * @param string $id
     * @return mixed
     * @throws NotFoundException
     * @throws ContainerException
     */
    public function get($id);

    /**
     * @param string $id
     * @return bool
     */
    public function has($id);<commit_msg>[typo] Remove duplicate word in README.md<commit_after># Acclimate - Container Adapters

[![License](https://poser.pugx.org/acclimate/container/license.png)](https://packagist.org/packages/acclimate/container) [![Latest Stable Version](https://poser.pugx.org/acclimate/container/v/stable.png)](https://packagist.org/packages/acclimate/container) [![Build Status](https://travis-ci.org/jeremeamia/acclimate-container.png)](https://travis-ci.org/jeremeamia/acclimate-container) [![Code Coverage](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/badges/coverage.png?s=fe11762e3c76d92ffbd4a7220e6b72c958d62b41)](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/badges/quality-score.png?s=30cc017c8a53f50fec5b5becd7aa648930b9a1c0)](https://scrutinizer-ci.com/g/jeremeamia/acclimate-container/)

**Get Acclimated!** Use any third-party dependency injection containers and service locators in your code by adapting
them to a common container interface. Acclimate was created by [<NAME>](https://twitter.com/jeremeamia).

## Introduction

It seems like every framework has its own container object. They come in many shapes and sizes (service locator, service
manager, service container, dependency injection (DI) container, registry, etc.), but are all generally used in a
similar way.

The wide variety of implementations makes it hard for other frameworks, framework-agnostic libraries, or some
applications to get the full benefits of using an inversion of control (IoC) system, because they either need to:

1. Write their own container implementation (NIH Syndrome)
2. Have a long-term dependency on a particular, third-party container implementation (and force that dependency on
   their users, which may already be using a different container implementation)
3. Implement an abstraction layer to support one or more third-party containers

**Acclimate** is a library that does \#3 for you. It provides a set of adapters for the most popular
container implementations. This allows you to adapt, _or "acclimate"_, instances of these containers to a common,
normalized, and **interoperable** interface. Using Acclimate allows your framework, library, or application to retrieve
items from the container objects of third-party libraries. That's interoperability!

## The Container Interface

The `ContainerInterface` used by Acclimate comes from the
[`container-interop/container-interop`](https://github.com/container-interop/container-interop) project. It attempts
to normalize the various implementations of container interfaces (whether they be for service locators, dependency
injection containers, or something else similar) to a simple, readonly interface, that allows users to retrieve
entries from any third-party container in a consistent way.

The `ContainerInterface` looks like this:

```php
namespace Interop\Container;

interface ContainerInterface
{
    /**
     * @param string $id
     * @return mixed
     * @throws NotFoundException
     * @throws ContainerException
     */
    public function get($id);

    /**
     * @param string $id
     * @return bool
     */
    public function has($id);
{'fraction_non_alphanumeric': 0.09317156634002177, 'fraction_numerical': 0.015865608959402706, 'mean_word_length': 5.159003831417625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4565891', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1763, 'n_words': 617}