PHPackages                             kittenphp/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kittenphp/container

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kittenphp/container
===================

Simple Lightweight container

1.0.0(8y ago)0451MITPHPPHP ^7.0

Since Jan 18Pushed 8y agoCompare

[ Source](https://github.com/kittenphp/container)[ Packagist](https://packagist.org/packages/kittenphp/container)[ RSS](/packages/kittenphp-container/feed)WikiDiscussions master Synced 2w ago

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

### Introduced

[](#introduced)

This package is a lightweight service container.

### install

[](#install)

> composer require kittenphp/container

### Example

[](#example)

#### 1. Define the service

[](#1-define-the-service)

Each service is an ordinary PHP class that can provide some functionality:

```
class Service{
    public function show(){
        echo 'hello world! (kittenphp/container)';
    }
}
```

#### 2. Registration service

[](#2-registration-service)

```
use kitten\component\container\Container;
$c=new Container();
$c->set(Service::class,function (){
    return new Service();
});
```

#### 3.Registering Shared Services

[](#3registering-shared-services)

```
$c->share(Service::class,function (){
   return new Service();
});
```

#### 4. Registering multiple services

[](#4-registering-multiple-services)

```
class ServiceProvider implements ServiceProviderInterface{

    function register(ExpandContainerInterface $container)
    {
        $container->share(ServiceA::class,function (){
            return new ServiceA();
        });
        $container->share(ServiceB::class,function (){
            return new ServiceB();
        });
        $container->share(ServiceC::class,function (){
            return new ServiceC();
        });
    }
}
$c->addServiceProvider(new ServiceProvider());
```

#### 5. Get Service

[](#5-get-service)

```
$c->get(Service::class)->show();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

3085d ago

### Community

Maintainers

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

---

Top Contributors

[![kittenphp](https://avatars.githubusercontent.com/u/34338839?v=4)](https://github.com/kittenphp "kittenphp (1 commits)")

### Embed Badge

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

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k447.1M9.1k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706127.7M12.7k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31180.7M2.3k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

20062.9M225](/packages/symfony-type-info)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)

PHPackages © 2026

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