PHPackages                             cakephp/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. [Framework](/categories/framework)
4. /
5. cakephp/container

ActiveLibrary[Framework](/categories/framework)

cakephp/container
=================

A fast and intuitive dependency injection container.

5.x-dev(yesterday)00MITPHP &gt;=8.2

Since Jul 21Compare

[ Source](https://github.com/cakephp/container)[ Packagist](https://packagist.org/packages/cakephp/container)[ Docs](https://cakephp.org)[ RSS](/packages/cakephp-container/feed)WikiDiscussions Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![Total Downloads](https://camo.githubusercontent.com/6c2f6e5be5f9cae65005eb06242b5d2ebcc3b3e6c0f3425308edab2c2fddc471/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616b657068702f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cakephp/container)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP Container Library
=========================

[](#cakephp-container-library)

The Container library provides a PSR-11 compatible dependency injection container for defining application services and resolving their dependencies.

Usage
-----

[](#usage)

Services can be defined with concrete classes, shared instances, factory functions, or interface mappings:

```
use App\Service\AuditLogService;
use App\Service\AuditLogServiceInterface;
use App\Service\ApiClient;
use App\Service\BillingService;
use Cake\Container\Container;

$container = new Container();

// Add a concrete class.
$container->add(BillingService::class);

// Add a singleton service.
$container->addShared('apiClient', fn () => new ApiClient('https://example.com'));

// Add an implementation for an interface.
$container->add(AuditLogServiceInterface::class, AuditLogService::class);

$billing = $container->get(BillingService::class);
```

Definitions can also have arguments, tags, and service providers attached when your application needs more control over how objects are built.

Documentation
-------------

[](#documentation)

Please make sure you check the [official documentation](https://book.cakephp.org/5/en/development/dependency-injection.html)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23666?v=4)[CakePHP](/maintainers/cakephp)[@cakephp](https://github.com/cakephp)

---

Tags

containerdependencyinjectioncakephpdiserviceprovider

### Embed Badge

![Health badge](/badges/cakephp-container/health.svg)

```
[![Health](https://phpackages.com/badges/cakephp-container/health.svg)](https://phpackages.com/packages/cakephp-container)
```

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86894.4M448](/packages/league-container)[yiisoft/di

Yii DI container

2391.4M131](/packages/yiisoft-di)[cakephp/core

CakePHP Framework Core classes

6128.7M64](/packages/cakephp-core)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2860.1k2](/packages/capsule-di)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
