PHPackages                             cspray/annotated-container - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. cspray/annotated-container

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

cspray/annotated-container
==========================

Create Dependency Injection containers configured with PHP8 Attributes.

v2.3.0(2y ago)421.3k2[24 issues](https://github.com/cspray/annotated-container/issues)[3 PRs](https://github.com/cspray/annotated-container/pulls)5MITPHPPHP ^8.1CI passing

Since Apr 7Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/cspray/annotated-container)[ Packagist](https://packagist.org/packages/cspray/annotated-container)[ RSS](/packages/cspray-annotated-container/feed)WikiDiscussions release-2.x Synced 3w ago

READMEChangelog (10)Dependencies (20)Versions (40)Used By (5)

AnnotatedContainer
==================

[](#annotatedcontainer)

[![Unit Tests](https://github.com/cspray/annotated-container/actions/workflows/php.yml/badge.svg)](https://github.com/cspray/annotated-container/actions/workflows/php.yml)

A Dependency Injection framework for creating an autowired, feature-rich, [PSR-11](https://www.php-fig.org/psr/psr-11/) compatible Container using PHP 8 Attributes!

- Designate an interface as a Service and easily configure which concrete implementations to use
- Delegate service construction to a factory
- Inject scalar values, environment variables, and other services into your constructors and setters
- Automatically invoke methods after the service is constructed
- Use Profiles to easily use different services in different runtimes
- Create type-safe, highly flexible configuration objects
- Easily include third-party services that cannot be easily annotated
- Bring Your Own Container!

Quick Start
-----------

[](#quick-start)

This quick start is intended to get you familiar with Annotated Container's core functionality and get a working Container created. First, a simple example showing how an interface can be aliased to a concrete Service. After that we'll show you how to get a Container to create the Service.

### Code Example

[](#code-example)

```
