PHPackages                             top-cat-software/tcsf-di - 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. top-cat-software/tcsf-di

ActiveLibrary[Framework](/categories/framework)

top-cat-software/tcsf-di
========================

Top Cat Software Framework Dependency Injection module

0.1.1(11mo ago)00MITPHPPHP ^8.3

Since Jun 8Pushed 11mo agoCompare

[ Source](https://github.com/top-cat-software/tcsf-di)[ Packagist](https://packagist.org/packages/top-cat-software/tcsf-di)[ RSS](/packages/top-cat-software-tcsf-di/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Top Cat Software Framework Dependency Injection
===============================================

[](#top-cat-software-framework-dependency-injection)

A lightweight, powerful dependency injection container for PHP 8.4+.

Features
--------

[](#features)

- Simple, intuitive API
- Autowiring of dependencies
- Support for singleton instances
- Factory bindings
- Interface to implementation binding
- PSR-4 compliant

Installation
------------

[](#installation)

```
composer require top-cat-software/tcsf-di
```

Basic Usage
-----------

[](#basic-usage)

```
use TCSF\DI\Container;

// Get the container instance
$container = Container::instance();

// Create an instance with autowiring
$myService = $container->create(MyService::class);
```

Binding Interfaces to Implementations
-------------------------------------

[](#binding-interfaces-to-implementations)

```
use TCSF\DI\Container;

// Bind an interface to a concrete implementation
$container = Container::instance();
$container->bind(MyInterface::class, MyImplementation::class);

// Now you can create instances of the interface
$instance = $container->create(MyInterface::class);
// $instance will be an instance of MyImplementation
```

Singleton Bindings
------------------

[](#singleton-bindings)

```
use TCSF\DI\Container;

// Bind a class as a singleton
$container = Container::instance();
$container->singleton(MyService::class, MyService::class);

// Get the same instance each time
$instance1 = $container->create(MyService::class);
$instance2 = $container->create(MyService::class);
// $instance1 === $instance2
```

Factory Bindings
----------------

[](#factory-bindings)

```
use TCSF\DI\Container;

// Bind a class to a factory function
$container = Container::instance();
$container->bind(MyService::class, function($container) {
    return new MyService('custom', 'parameters');
});

// Create an instance using the factory
$instance = $container->create(MyService::class);
```

Registering Existing Instances
------------------------------

[](#registering-existing-instances)

```
use TCSF\DI\Container;

// Create an instance manually
$myService = new MyService('custom', 'parameters');

// Register it with the container
$container = Container::instance();
$container->registerInstance(MyService::class, $myService);

// Get the same instance back
$instance = $container->create(MyService::class);
// $instance === $myService
```

Autowiring
----------

[](#autowiring)

The container automatically resolves dependencies by type-hinting:

```
class UserRepository
{
    // Implementation...
}

class UserService
{
    private UserRepository $repository;

    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }
}

// The container will automatically create a UserRepository when creating a UserService
$userService = $container->create(UserService::class);
```

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance52

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Every ~0 days

Total

2

Last Release

339d ago

PHP version history (2 changes)0.1.0PHP ^8.4

0.1.1PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6937f32f5f78834aeb9a5f2afd13266241d9bf3ba09c0101d2655bc3d6e7d0e0?d=identicon)[TJCDev](/maintainers/TJCDev)

---

Top Contributors

[![tjcdeveloper](https://avatars.githubusercontent.com/u/29662644?v=4)](https://github.com/tjcdeveloper "tjcdeveloper (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/top-cat-software-tcsf-di/health.svg)

```
[![Health](https://phpackages.com/badges/top-cat-software-tcsf-di/health.svg)](https://phpackages.com/packages/top-cat-software-tcsf-di)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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